Losing subscription when a new long poll is created
nva Jun 16, 2012 12:22 PMI'm using Errai 2.0.1-SNAPSHOT (as in git on 2012-06-16) and jetty (GWT development mode), and configured the JettyContinuationsServlet and the AsyncDispatcher. Have observed the following behaviour:
1. On the server side a process is constantly broadcasting messages on the bus, approximately 10 msg/sec. The message now is a single String of varying length, up to about 128 characters max:
MessageBuilder.createMessage()
.toSubject("MySubject")
.with("MyPart", buff)
.errorsHandledBy(new ErrorCallback() {
@Override
public boolean error(Message message, Throwable throwable) {
log.debug("Error marshalling/sending message: " + buff + ": " + throwable.getMessage(), throwable);
return true;
}
}).sendGlobalWith(erraiDispatcher);
2. On the client side I have a singleton module that subscribes to the same subject when the client starts up:
ErraiBus.get().subscribe("MySubject", new MessageCallback() {
@Override
public void callback(Message message) {
String buff = message.get(String.class, "MyPart");
// process buffer
});
(Errai IOC is present on the client side, but is not used. It conflicts with GWTP.)
3. The client-side starts up normally and messages flow. The following is logged to the browser's console:
[errai] wait for: org.jboss.errai.marshalling.client.api.MarshallerFramework
[errai] vote For: org.jboss.errai.marshalling.client.api.MarshallerFramework
[errai] wait for: org.jboss.errai.bus.client.framework.ClientMessageBus
[errai] wait for: org.jboss.errai.bus.client.framework.RpcProxyLoader
[errai] sending initial handshake to remote bus
[errai] wait for: org.jboss.errai.ioc.client.Container
[errai] IOC bootstrapper successfully initialized.
[errai] IOC container bootstrapped.
[errai] 12 beans successfully deployed.
[errai] vote For: org.jboss.errai.ioc.client.Container
[errai] still waiting for -> [org.jboss.errai.bus.client.framework.RpcProxyLoader, org.jboss.errai.bus.client.framework.ClientMessageBus]
[errai] received response from initial handshake.
[errai] vote For: org.jboss.errai.bus.client.framework.RpcProxyLoader
[errai] still waiting for -> [org.jboss.errai.bus.client.framework.ClientMessageBus]
[errai] remote services available: [...]
[errai] received capabilities notice from server. supported capabilities of remote: LongPollAvailable
[errai] initializing long poll subsystem
[errai] received FinishStateSync message. preparing to bring up the federation
[errai] vote For: org.jboss.errai.bus.client.framework.ClientMessageBus
[errai] received final vote for initialization ...
[errai] bus federation complete. now operating normally.
4. After a short while the following appears in the browser's console and the flow of messages stops:
[errai] sending initial handshake to remote bus
[errai] received response from initial handshake.
[errai] remote services available: [...]
[errai] received capabilities notice from server. supported capabilities of remote: LongPollAvailable
[errai] initializing long poll subsystem
[errai] received FinishStateSync message. preparing to bring up the federation
The server side is still broadcasting and calling isSubscribed("MySubject") returns true, however, no messages are received on the client side any longer. There are no errors given to the server-side error handler.
As a workaround, I set up a timer that executes a new subscription on the given subject every few seconds. When a new subscription is executed, the data starts flowing, until the next stop.
In summary, the subscription information remains persistent, but it seems that when the client makes a new long poll, the data is not dispatched into it.
What would you suggest I should look at next? Many thanks!
Cheers,
V.