Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Consumers Connected for a Long Time - Where to keep them?  (Read 3173 times)
codecraig
Full Member
***
Posts: 23


View Profile Email
« on: October 02, 2008, 03:01:58 »

So I have a Consumer which "subscribes" to a JMS topic.  Initially I had this thing in a Proxy so that it could get results and update its data, etc.

However, I felt like using Commands was a better approach.  The problem with a command is we must not use it to maintain state.  So, I shouldn't keep the "Consumer" object in it....b/c later I need to invoke "Consumer.unsubscribe" to clean up my connection.

Any suggestions on this?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: October 02, 2008, 04:55:03 »

Put the Consumer in a Proxy. You can always have a Command manipulate the Proxy if you feel the need, but don't make Commands long-lived. There's no way to retrieve a running Command to fiddle with this long-lived thing. This is the whole reason for the Proxy class, which is long lived, retrievable and is is intended to encapsulate any communications with the server necessary while making the data available to the rest of the app.
-=Cliff> 
Logged
Pages: [1]
Print