本文整理汇总了Java中org.jboss.errai.bus.client.api.messaging.MessageCallback类的典型用法代码示例。如果您正苦于以下问题:Java MessageCallback类的具体用法?Java MessageCallback怎么用?Java MessageCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageCallback类属于org.jboss.errai.bus.client.api.messaging包,在下文中一共展示了MessageCallback类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessage
import org.jboss.errai.bus.client.api.messaging.MessageCallback; //导入依赖的package包/类
private void sendMessage() {
final String messageText = messageTextBox.getText();
if ("".equals(messageText)) {
setStatus("message is mandatory");
messageTextBox.setFocus(true);
return;
}
setStatus("sending message from Errai Bus Client ...");
MessageBuilder.createMessage()
.toSubject("HelloWorldService")
.withValue(messageText)
.done()
.repliesTo(new MessageCallback() {
public void callback(Message message) {
setStatus("Response from server: " + message.get(String.class, MessageParts.Value));
}
})
.sendNowWith(messageBus);
}
示例2: onPostConstruct
import org.jboss.errai.bus.client.api.messaging.MessageCallback; //导入依赖的package包/类
/**
* Called when the service is constructed.
*/
@PostConstruct
private void onPostConstruct() {
bus.subscribe("NotificationService", new MessageCallback() { //$NON-NLS-1$
@Override
public void callback(Message message) {
NotificationBean notification = message.getValue(NotificationBean.class);
doNotify(notification);
}
});
}
示例3: onPageShown
import org.jboss.errai.bus.client.api.messaging.MessageCallback; //导入依赖的package包/类
/**
* Called whenver the page is shown.
*/
@PageShown
public void onPageShown() {
GWT.log("Subscribing to SitWatch topic."); //$NON-NLS-1$
bus.subscribe("SitWatch", new MessageCallback() { //$NON-NLS-1$
@Override
public void callback(Message message) {
SituationEventBean sitEvent = message.get(SituationEventBean.class, "situation"); //$NON-NLS-1$
onNewSituation(sitEvent);
}
});
}
示例4: onPostConstruct
import org.jboss.errai.bus.client.api.messaging.MessageCallback; //导入依赖的package包/类
/**
* Called when the service is constructed.
*/
@PostConstruct
private void onPostConstruct() {
bus.subscribe("NotificationService", new MessageCallback() { //$NON-NLS-1$
@Override
public void callback(Message message) {
NotificationBean notification = message.getValue(NotificationBean.class);
doNotify(notification);
}
});
}