I’m having trouble getting a message to go through using ErraiBus. I’m using this on the client side:
CommandMessage msg = (CommandMessage) CommandMessage.create().toSubject("Items").set("SerialNumber", serialInput.getValue());
bus.conversationWith(msg, new MessageCallback() {
@Override
public void callback(Message message) {
//throw new UnsupportedOperationException("Not supported yet.");
Item item = message.get(Item.class, "Item");
MessageBox.alert("Errai", item.getSerialNumber().toString(), null);
}
});
With this on the server side:
@Service("Items")
public class Items implements MessageCallback {
private MessageBus bus;
@Inject
public Items(MessageBus bus) {
this.bus = bus;
System.out.println("Got a bus...");
}
@Override
public void callback(Message message) {
//throw new UnsupportedOperationException("Not supported yet.");
System.out.println("Incoming message...");
Long serialNum = message.get(Long.class, "SerialNumber");
System.out.println(serialNum);
Item item = new Item();
item.setSerialNumber(serialNum);
ConversationMessage.create(message).set("Item",item).sendNowWith(bus);
}
}
However, all it seems to send is:
{"CommandType":"RemoteSubscribe","ToSubject":"ServerBus","Subject":"temp:Conversation:2","PriorityProcessing":"1"}
I don’t see where it actually sends my body or the subject that I fill out in my message. Nothing also gets to the Service class. Am I doing something wrong? I have Tomcat running NIO and everything else seems set up correctly. It will keep a GET connection open and do the POST of the JSON above, but nowhere does it seem to send what I want it to. I also seem to be getting these occasionally, usually on some of the first requests to in.erraiBus:
java.lang.NullPointerException
at org.jboss.errai.bus.server.servlet.TomcatCometServlet.event(TomcatCometServlet.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.event(Unknown Source)
at org.apache.catalina.core.StandardContextValve.event(Unknown Source)
at org.apache.catalina.core.StandardHostValve.event(Unknown Source)
at org.apache.catalina.valves.ValveBase.event(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.event(Unknown Source)
at org.apache.catalina.connector.CoyoteAdapter.event(Unknown Source)
at org.apache.coyote.http11.Http11NioProcessor.event(Unknown Source)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.event(Unknown Source)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Can anyone point me at what I’m missing?