Conversations Crossing to Other Clients
williajd Mar 11, 2011 6:56 AMI have a small problem with using conversations.
I have a widget that loads a default set of filter parameters when it loads. These parameters can be changed by the user as much as they like.
I use the following to request the default values:
MessageBuilder.createMessage()
.toSubject("DefaultReplayFilter")
.signalling()
.with(MessageParts.ReplyTo, "SetReplayFilter")
.noErrorHandling()
.sendNowWith(ErraiBus.getDispatcher());
The server side service sends back the default filter using the following:
MessageBuilder.createConversation(message)
.subjectProvided()
.signalling()
.with("filter", filter)
.noErrorHandling()
.reply();
I have also subscribed to get the result using this:
this.bus.subscribe("SetReplayFilter", new UpdateFilterMessageCallback());
This works really well, for one client. However the if there is more than one client open the other clients are having their filters reset too! This is not what I want. Am I missing something obvious? I used http://www.errai-framework.org/docs/html/en/#d0e264 this as a guide to how to do this and it looks fairly simple.
I also tried this to make the call from the client:
MessageBuilder.createMessage()
.toSubject("DefaultReplayFilter")
.signalling()
.noErrorHandling()
.repliesTo(new UpdateFilterMessageCallback())
.sendNowWith(dispatcher);
The call is made, however the server throws an exception:
[ERROR] Exception in thread "Dispatch Worker Thread" java.lang.RuntimeException: cannot have a conversation. the incoming message has not session data associated with it.
[ERROR] at org.jboss.errai.bus.client.api.builder.ConversationMessageWrapper.commit(ConversationMessageWrapper.java:213)
[ERROR] at org.jboss.errai.bus.server.ServerMessageBusImpl.send(ServerMessageBusImpl.java:378)
[ERROR] at org.jboss.errai.bus.client.api.builder.ConversationMessageWrapper.sendNowWith(ConversationMessageWrapper.java:183)
[ERROR] at org.jboss.errai.bus.client.api.builder.AbstractMessageBuilder$1.sendNowWith(AbstractMessageBuilder.java:59)
[ERROR] at org.jboss.errai.bus.client.util.ErrorHelper.sendClientError(ErrorHelper.java:104)
[ERROR] at org.jboss.errai.bus.client.util.ErrorHelper.sendClientError(ErrorHelper.java:76)
[ERROR] at org.jboss.errai.bus.client.util.ErrorHelper.handleMessageDeliveryFailure(ErrorHelper.java:156)
[ERROR] at org.jboss.errai.bus.server.Worker.run(Worker.java:128)
I'm using CDI, Seam 3, Tomcat, Jetty. Here is my Maven dependency tree:
[INFO] +- org.jboss.errai:errai-bus:jar:1.1-Final:compile
[INFO] | +- org.jboss.errai:errai-common:jar:1.1-Final:compile
[INFO] | +- com.google.code.guice:guice:jar:2.0:compile
[INFO] | +- com.google.code.guice:guice:jar:aopalliance:2.0:compile
[INFO] | +- com.google.code.guice:guice-servlet:jar:2.0:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.5.10:compile
[INFO] | | \- log4j:log4j:jar:1.2.14:compile
[INFO] | +- junit:junit:jar:4.8.1:compile
[INFO] | +- org.reflections:reflections:jar:0.9.5-RC2_jboss-SP1:compile
[INFO] | | \- com.google.collections:google-collections:jar:1.0:compile
[INFO] | \- javassist:javassist:jar:3.12.1.GA:compile
[INFO] +- org.jboss.errai:errai-workspaces:jar:1.1-Final:compile
[INFO] | +- org.jboss.errai:errai-widgets:jar:1.1-Final:compile
[INFO] | +- com.googlecode.gwtmosaic:gwt-mosaic:jar:0.4.0-rc4:compile
[INFO] | +- com.googlecode.gwtmosaic:gwt-beans-binding:jar:0.4.0-rc4:compile
[INFO] | +- com.googlecode.gwtmosaic:gwt-dnd:jar:0.4.0-rc4:compile
[INFO] | +- com.googlecode.gwtmosaic:gwtx:jar:0.4.0-rc4:compile
[INFO] | \- com.google.code.gwt-log:gwt-log:jar:3.0.1:compile
[INFO] +- org.jboss.errai:errai-ioc:jar:1.1-Final:compile
[INFO] +- org.mvel:mvel2:jar:2.0.18:compile
[INFO] +- org.jboss.errai:errai-cdi:jar:1.1-Beta2:compile
[INFO] | \- org.jboss.weld.servlet:weld-servlet:jar:1.1.0.Beta2:compile
[INFO] +- org.jboss.errai:errai-cdi-jetty:jar:1.1-Beta2:compile
[INFO] +- org.mortbay.jetty:jetty:jar:6.1.25:compile
[INFO] | +- org.mortbay.jetty:jetty-util:jar:6.1.25:compile
[INFO] | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
[INFO] +- org.mortbay.jetty:jetty-plus:jar:6.1.25:compile
[INFO] | \- geronimo-spec:geronimo-spec-jta:jar:1.0.1B-rc4:compile
[INFO] +- org.mortbay.jetty:jetty-naming:jar:6.1.25:compile
[INFO] | \- javax.mail:mail:jar:1.4:compile
[INFO] +- org.jboss.seam.solder:seam-solder-api:jar:3.0.0-PLUS-1:runtime (scope not updated to compile)
[INFO] +- org.jboss.seam.solder:seam-solder-impl:jar:3.0.0-PLUS-1:compile
[INFO] +- org.jboss.seam.servlet:seam-servlet-impl:jar:3.0.0.Alpha3:compile
[INFO] +- org.jboss.seam.servlet:seam-servlet:jar:3.0.0.Alpha3:compile
[INFO] +- org.jboss.seam.persistence:seam-persistence-api:jar:3.0.0.Beta2:compile
[INFO] +- org.jboss.seam.persistence:seam-persistence-impl:jar:3.0.0.Beta2:compile
[INFO] +- org.glassfish.web:el-impl:jar:2.1.2-b04:runtime
[INFO] | \- javax.el:el-api:jar:2.1.2-b04:runtime
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO] | +- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] | | \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | \- cglib:cglib:jar:2.2:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] +- com.google.gwt:gwt-dev:jar:2.1.1:compile
[INFO] +- com.google.gwt:gwt-user:jar:2.1.1:compile
[INFO] +- org.jboss.logging:jboss-logging:jar:3.0.0.Beta4:runtime
[INFO] +- org.slf4j:slf4j-api:jar:1.5.11:compile
[INFO] \- org.apache.tomcat:catalina:jar:6.0.20:provided
[INFO] +- org.apache.tomcat:servlet-api:jar:6.0.20:provided
[INFO] +- org.apache.tomcat:juli:jar:6.0.20:provided
[INFO] \- org.apache.tomcat:annotations-api:jar:6.0.20:provided
This has got me a little flummoxed. I think I have a work around which is to append a session id to the name of any client topic that must be conversational. Not ideal though.
There are other place I need this to work so any help would be greatly appreciated.
Thanks in advance, James