Cant get Message API to work.
subhrajyotimoitra Mar 30, 2015 5:43 AMHello,
I am using Errai 3.1.2.Final for development, wildfly 8.2.0.
I am using the MessageBuilder and related APIs to send messages. I dont seem to recieve the messages on the MessageCallback at all.
My Entry point
@EntryPoint
public class LiveShowNotes {
private static final Logger logger=Logger.getLogger(LiveShowNotes.class.getName());
private Place defaultPlace=new DashboardPlace();
@PostConstruct
public void init(){
IClientFactory clientFactory= GWT.create(IClientFactory.class);
......
}
@AfterInitialization
public void afterInit(){
MessageBus requestDispatcher= ErraiBus.get();
MessageBuilder
.createMessage()
.toSubject("CaptureShowNoteService")
.with("badgeValue", "somevalue")
.with("timestampValue", "so,metimevalue")
.with("showNumber","HSn18Shn_100")
.with("type", BadgeInfo.Type.MESSAGING.name())
.noErrorHandling()
.sendNowWith(requestDispatcher);
logger.info("Errai after initialization..");
}
}
My MessageCallback
@Service
public class CaptureShowNoteService implements MessageCallback {
@Inject
Logger logger;
private final RequestDispatcher requestDispatcher;
@Inject
public CaptureShowNoteService(RequestDispatcher requestDispatcher){
this.requestDispatcher=requestDispatcher;
}
@Override
public void callback(Message message) {
System.out.println("Message rx on Subject: "+message.getSubject());
Map<String, Object> parts = message.getParts();
if(parts!=null){
for (String key : parts.keySet()) {
if (parts.get(key) != null) {
String value = parts.get(key).toString();
System.out.println("Parts key: " + key + ", val: " + value);
}
}
}
//TODO this same message is to be sent to the DetailedShowNotes screen for the same showNumber.
MessageBuilder
.createMessage()
.toSubject("DetailedShowNotesClient")
.signalling()
.with("badgeValue", RandomStringUtils.random(5,true,true))
.with("timestampValue",RandomStringUtils.randomNumeric(5))
.with("showNumber",RandomStringUtils.random(5,true,true))
.with("type", BadgeInfo.Type.VISUAL.name())
.noErrorHandling()
.sendNowWith(requestDispatcher);
System.out.println("DetailedShowNotes message sent...");
}
}
My gwt.xml file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN" "http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd"> <module rename-to="LiveShowNotes"> <inherits name="com.google.gwt.user.User" /> <inherits name="com.google.gwt.http.HTTP" /> <inherits name="com.google.gwt.json.JSON" /> <inherits name="com.google.gwt.i18n.I18N" /> <inherits name="com.google.gwt.uibinder.UiBinder"/> <inherits name="com.google.gwt.logging.Logging"/> <inherits name="org.jboss.errai.enterprise.All" /> <inherits name="com.google.gwt.user.UserAgent"/> <inherits name="com.google.gwt.place.Place"/> <inherits name="com.google.gwt.activity.Activity"/> <inherits name="org.gwtbootstrap3.GwtBootstrap3"/> <inherits name="com.dev.liveshownotes.client.Resources"/> <replace-with class="com.dev.liveshownotes.client.local.ClientFactoryImpl"> <when-type-is class="com.dev.liveshownotes.client.local.IClientFactory"/> </replace-with> <set-property name="user.agent" value="safari" /> <set-property name="gwt.logging.enabled" value="TRUE"/> <set-property name="gwt.logging.logLevel" value="INFO"/> <set-property name="gwt.logging.consoleHandler" value="DISABLED" /> <set-property name="gwt.logging.developmentModeHandler" value="DISABLED" /> <!--<set-property name="gwt.logging.firebugHandler" value="DISABLED" />--> <set-property name="gwt.logging.hasWidgetsHandler" value="DISABLED" /> <!-- <set-property name="gwt.logging.popupHandler" value="DISABLED" />--> <set-property name="gwt.logging.systemHandler" value="DISABLED" /> <set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" /> </module>
On the server none of the messages are being received.
What am i missing? or doing wrong.?
Please help. I am stuck with this.
Thanks a lot in advance.
Thanks,
Subhro.

