Blaze 4.0
I have a flex desktop app which has only one consumer using a streaming amfChannel. So there is no producer.
After 30 minutes my channel gets disconnected, because the httpsession on the server expired. The connection was not idle, because every second 2 messages are streamed.
I also defined a heartbeatInterval on the channelset, but still the session expires.
This is the Logging:
BlazeDS :07/02/2012 19:09:49.165 [DEBUG] [Client.MessageClient] MessageClient created with clientId '696A7855-841D-ABE3-505A-AE5699DF4B4A' for destination 'messages-feed'.
BlazeDS :07/02/2012 19:39:06.434 [DEBUG] [Client.MessageClient] MessageClient with clientId '696A7855-841D-ABE3-505A-AE5699DF4B4A' for destination 'messages-feed' has been invalidated.
BlazeDS :07/02/2012 19:39:06.435 [DEBUG] [Client.FlexClient] FlexClient with id '696A75CE-8B0E-949A-47CC-9F8256CC96F7' has been invalidated.
Consumer:
<mx:Consumer id="consumer"
destination="messages-feed"
channelSet="{channelSet}"
resubscribeInterval="5000"
resubscribeAttempts="-1"
message="messageHandler(event)"
channelDisconnect="consumerDisconnectHandler(event)"
/>
Why is the HTTP session expiring? Is that because only messages are pushed in the direction from server to client?
In the services-config.xml, can you make sure you have both server-to-client-heartbeat-millis defined on the channel and heartbeat-interval-millis defined on the flex-client? This happens because even though the streaming connection is open, the App Server ivalidates the session if there is no incoming request from the client side. Ideally setting server-to-client-heartbeat-millis on the services-config.xml should fix this.
Thanks for your reply, but I already had defined <server-to-client-heartbeat-millis> on my server and the heartbeatInterval on my Client ChannelSet.
This is really annoying and I can't imagine I'm the only one seeing this behaviour. I'm just doing common things with BlazeDS.
Does anyone knows what is causing this?
Here is my channel definition:
<channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
<properties>
<idle-timeout-minutes>0</idle-timeout-minutes>
<max-streaming-clients>10</max-streaming-clients>
<invalidate-session-on-disconnect>true</invalidate-session-on-disconnect>
<server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis>
</properties>
</channel-definition>
And here is the logging again:
03-07-2012 09:54:04 INFO org.springframework.flex.servlet.MessageBrokerHandlerAdapter-107 - Channel endpoint my-streaming-amf received request.
BlazeDS :07/03/2012 09:54:04.815 [DEBUG] [Client.FlexClient] FlexClient created with id '7122F2D2-AE08-F56F-5847-5F35278C72F2'.
03-07-2012 09:54:05 INFO org.springframework.flex.servlet.MessageBrokerHandlerAdapter-107 - Channel endpoint my-streaming-amf received request.
03-07-2012 09:54:06 INFO org.springframework.flex.servlet.MessageBrokerHandlerAdapter-107 - Channel endpoint my-streaming-amf received request.
BlazeDS :07/03/2012 09:54:06.029 [DEBUG] [Client.MessageClient] MessageClient created with clientId '7122FE3D-0B0C-D456-3DC4-10FC2244F99D' for destination 'messages-feed'.
BlazeDS :07/03/2012 10:27:04.383 [DEBUG] [Client.MessageClient] MessageClient with clientId '7122FE3D-0B0C-D456-3DC4-10FC2244F99D' for destination 'messages-feed' has been invalidated.
BlazeDS :07/03/2012 10:27:04.384 [DEBUG] [Client.FlexClient] FlexClient with id '7122F2D2-AE08-F56F-5847-5F35278C72F2' has been invalidated.
I wanted to add a workaround for this "session invalidated" issue and handle the disconnect event on the client side and do a subscribe again.
protected function consumerDisconnectHandler(event:ChannelEvent):void {
consumer.subscribe();
}
But for some reason this doesn't work as well.
On the server side I can see that a FlexClient is created, with the same id (as the first time before it got invalidated)
But there is no MessageClient created this time. So the consumer re-subscribtion isn't re-established correctly.
What is causing this?
As you can see in the server logging, I use Spring with BlazeDS.
Does anyone has a solution?
Server Logging:
03-07-2012 10:43:39 INFO org.springframework.flex.servlet.MessageBrokerHandlerAdapter-107 - Channel endpoint my-streaming-amf received request.
BlazeDS :07/03/2012 10:43:39.554 [DEBUG] [Client.FlexClient] FlexClient created with id '7122F2D2-AE08-F56F-5847-5F35278C72F2'.
North America
Europe, Middle East and Africa
Asia Pacific