-
1. Re: Sending message from server to client
heiko.braun Jul 13, 2010 4:51 AM (in response to blizzy)Just send it using a bus reference:
MessageBuilder.createMessage() .toSubject("HelloWorldClient") .signalling() .with("text", "Hi There") .noErrorHandling() .sendNowWith(bus);
You can do that in any business method of your service implementation,
The bus reference get's injected:
@Inject public HelloWorldService(MessageBus bus) { this.bus = bus; }
-
2. Re: Sending message from server to client
pottingshed Jun 3, 2011 2:16 PM (in response to heiko.braun)Hi,
I'm trying to do the same thing - notify client of successful authentication, without an initial client request. However, when I issue the following after authentication, I get the following exception:
Exception in thread "Dispatch Worker Thread" java.lang.RuntimeException: cannot have a conversation. the incoming message has not session data associated with it.
Presumably this is because there is no associated session. This is what I use to make the call:
RequestDispatcher erraiDispatcher = GneLifecycleListener.getSpringContext().getBean("erraiRequestDispatcher",
RequestDispatcher.class);
MessageBuilder.createMessage()
.toSubject("CommandFacadeMsg")
.signalling()
.with("gneCommand", GneCommand.SUCCESSFUL_AUTHENTICATION.toString()) // Use string, not enum
.with("gneUserVo", gneUserVo)
.noErrorHandling()
.sendNowWith(erraiDispatcher);
Where am I going wrong?
Thanks,
Errai Newbie.