I submitted an updated patch for https://issues.apache.org/activemq/browse/AMQ-2874 with the change described below.

alex

On Sep 14, 2010, at 11:03 AM, Alex Dean wrote:

Thanks.  I will work on this as soon as I can.

I submitted a change to the addListener() function in amq.js in https://issues.apache.org/activemq/browse/AMQ-2874 . I added a 4th argument which allows a user to specify a selector.

addListener( 'handlerName', 'topic://test', function(msg){ /* callback */ }, "some-header='some-value'" )

Since this clientId issue may end up requiring another value to be set during an addListener() call, I wonder if that ought to be changed to something more like:

addListener( 'handlerName', 'topic://test', function(msg){ /* callback */ }, { selector:"some-header='some-value'" } )

That would allow the 4th parameter to contain other configuration as well, in addition to a selector value. Perhaps something like this:

addListener( 'handlerName', 'topic://test', function(msg){ /* callback */ }, { selector:"some-header='some-value'", clientId:"test- client" } )

I will update the patch I attached to AMQ-2874 to make that work.

alex

On Sep 13, 2010, at 10:48 AM, Dejan Bosanac wrote:

Hi Alex,

with REST API (which shares some common code with Ajax stuff), you can
send clientId parameter to create/use client with the specified id
(and not be tied to the session). IMHO it should work the same with
Ajax API, so you can try with that for starters. If it doesn't work,
take a look at MessageListenerServlet

http://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?r=HEAD

as that is where's the most of the server side logic is implemented.

If you need to look at the REST Servlet for the reference, take a look at

http://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java?r=HEAD

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Mon, Sep 13, 2010 at 3:46 PM, Alex Dean <a...@crackpot.org> wrote:
I'd be interested in attempting a fix for this problem. Please send along
any information you think would help me get started.

thanks,
alex

On Sep 13, 2010, at 3:25 AM, Dejan Bosanac wrote:

Hi Alex,

unfortunately this is not supported at the moment as listeners are
tied to the session. The right approach would be to use some clientId defined in your application, like we have for REST and pass it to the servlet. If you're interested in taking a stab at implementing this, I
can point you to the code that should be improved.

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Fri, Sep 10, 2010 at 6:46 PM, Alex Dean <a...@crackpot.org> wrote:

I have been testing a web page displaying activemq data via the AJAX interface with AMQ 5.4. It works great when I have a single window open.
If I open the same page in a new browser window or tab, the new
window/tab
updates correctly but the previously-open one stops updating.

Firebug/Firefox in the previously-opened window starts reporting errors
like
"No handler found to match message with id = display43066495".
'display43066495' is the id used by the newly-opened window. I had
tried
ensuring that both windows opened with unique ids, but this hasn't solved
the problem.

I imagine this is due to the fact that both windows share the same
session
id on the broker. Is there a way to work around this problem, so I can
have
multiple windows open to the same amq/ajax-connected page?

thanks,
alex








Reply via email to