STRANGE : Exception caught: no subscribers to deliver to for subject.
jimmy.pannier Jan 20, 2015 5:07 AMHi,
i follow the documentation for the messaging service but i've an error when i'm using it :
Here the example used for the test.
In my entrypoint, i'm just adding a button to deliver a message "hi there" via a service MyEchoService to all users connected
But when i click it , i get the following error in browser console:
Exception caught: no subscribers to deliver to for subject: MyEchoService.
-CLIENT-SIDE-------------------------------------------------------------------------------------------------------------------------
<!- click to the button to call the myechoservice, and my echo service sends message to all users-->
verticalPanel.add(new UiButton("call myechoservice", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MessageBuilder.createMessage().toSubject("MyEchoService") // (1)
.signalling() // (2)
.noErrorHandling() // (3)
.sendNowWith(ErraiBus.get()); // (4)
}
}));
<!-- Listen the subject -->
ErraiBus.get().subscribe("test", new MessageCallback() {
@Override
public void callback(Message message) {
String messageText = message.get(String.class, "text");
Window.alert(messageText);
}
});
-SERVER-SIDE-------------------------------------------------------------------------------------------------------------------------
@Service
@WebServlet("/MyEchoService")
public class MyEchoService extends HttpServlet implements MessageCallback {
private MessageBus bus;
@Inject
public MyEchoService(MessageBus messageBus) {
this.bus = messageBus;
}
@Override
public void callback(Message message) {
test();
}
public void test() {
MessageBuilder.createMessage().toSubject("test").signalling().with("text", "Hi There").noErrorHandling().sendGlobalWith(bus);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
test();
}
}
I'm using the last version of wildfly. When i deploy i see the discoverd "myechoservice"
10:47:49,247 INFO [org.jboss.errai.cdi.server.CDIExtensionPoints] (MSC service thread 1-15) discovered errai service: [BackedAnnotatedType] public @Service @WebServlet class com.inovelan.cloud.portailps.server.MyEchoService
BUT
If a call the servlet via doGet() of the servlet /MyEchoService The window.alert works !
SO. Sending message from the client to the server doesn't work but sending message from server to client work.
I've searched what the problem many days but i don't find the solution.
Any Idea ?