You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dejan Bosanac <de...@nighttale.net> on 2010/10/01 10:36:00 UTC

Re: multiple ajax clients in the same browser?

Thanks Alex,

I'll see to take a look at (and commit) it in the next couple of days.


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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>
> alex
>
> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>
>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>
>> https://issues.apache.org/activemq/browse/AMQ-2948
>>
>> 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 <al...@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 <al...@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
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
>

Re: Multiple instances with ActiveMQ 5.4.1

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Phil,

yes, I observed the same during the tests, hence the changes in the
console project, that now supports that we pass the pid of the broker
we want to stop. But in order to make it work you need to modify the
activemq script as well and pass the pid when you stop the broker.

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 Thu, Oct 14, 2010 at 11:37 PM, Phil Pickett <pp...@vmware.com> wrote:
> It looks like specifying JMX properties with a unique port in each of the instance's start scripts (i.e., broker1/bin/broker1, broker2/bin/broker2, ...) may resolve this.  I also commented out the JMX properties in bin/activemq since I've defined it for the instances.
>
> Phil
>
> -----Original Message-----
> From: Phil Pickett [mailto:ppickett@vmware.com]
> Sent: Thursday, October 14, 2010 12:46 PM
> To: users@activemq.apache.org
> Subject: RE: Multiple instances with ActiveMQ 5.4.1
>
> Hi Dejan,
>
> Thanks a lot for creating the Jira and submitting the fix so quickly.  I had made the same change in the bin/activemq script to use $ACTIVEMQ_BASE for the ACTIVEMQ_CONFIG_DIR and ACTIVEMQ_DATA_DIR.  I've also rebuilt activemq-console and am using the new jar.
>
> This allows multiple instances to start, but shutting down an instance will still sometimes shutdown another instance unintentionally.  I'll include a command line capture below to illustrate this.  I've tracked the problem down to the org.apache.activemq.console.command.ShutdownCommand's runTask method.  For some reason, execution drops down into the "Get the first broker only" section where some unintended broker is added to the list and shutdown.  With the commands below, I attempt to stop broker1.  The broker1 instance is stopped, but then broker2 is stopped also.
>
> I haven't opened a Jira on this or the original issue since the scripts are new and I can't tell based on the docs I've read if I'm missing something in the instance configuration with the instance-specfic .activemqrc or activemq script.
>
> Phil
>
>
> [phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 start
> INFO: Using default configuration
> (you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)
>
> INFO: Invoke the following command to create a configuration file
> /home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]
>
> INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
> INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
> INFO: pidfile created : '/home/phil/apache-activemq-5.4.1/broker1/data/activemq.pid' (pid '24202')
>
> [phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
> phil     24122 32.7 14.2 434856 146024 pts/3   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker2/conf;/home/phil/apache-activemq-5.4.1/broker2/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker2 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
> phil     24202 72.2 14.1 434856 145560 pts/2   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
> phil     24263  0.0  0.0   4200   700 pts/2    S+   11:33   0:00 grep java
>
> [phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 stop
> INFO: Using default configuration
> (you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)
>
> INFO: Invoke the following command to create a configuration file
> /home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]
>
> INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
> INFO: Waiting at least 30 seconds for regular process termination of pid '24202' : Java Runtime: Sun Microsystems Inc. 1.6.0_21 /usr/java/jdk1.6.0_21/jre
>  Heap sizes: current=15552k  free=15188k  max=249472k
>    JVM args: -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1
> ACTIVEMQ_HOME: /home/phil/apache-activemq-5.4.1
> ACTIVEMQ_BASE: /home/phil/apache-activemq-5.4.1/broker1
> Connecting to pid: 24122
> Stopping broker: broker2
> ..
> INFO: Regular shutdown not successful,  sending SIGKILL to process with pid '24202'
>
> [phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
> phil     24356  0.0  0.0   4200   704 pts/2    S+   11:33   0:00 grep java
>
>

RE: Multiple instances with ActiveMQ 5.4.1

Posted by Phil Pickett <pp...@vmware.com>.
It looks like specifying JMX properties with a unique port in each of the instance's start scripts (i.e., broker1/bin/broker1, broker2/bin/broker2, ...) may resolve this.  I also commented out the JMX properties in bin/activemq since I've defined it for the instances.

Phil

-----Original Message-----
From: Phil Pickett [mailto:ppickett@vmware.com] 
Sent: Thursday, October 14, 2010 12:46 PM
To: users@activemq.apache.org
Subject: RE: Multiple instances with ActiveMQ 5.4.1

Hi Dejan,

Thanks a lot for creating the Jira and submitting the fix so quickly.  I had made the same change in the bin/activemq script to use $ACTIVEMQ_BASE for the ACTIVEMQ_CONFIG_DIR and ACTIVEMQ_DATA_DIR.  I've also rebuilt activemq-console and am using the new jar.

This allows multiple instances to start, but shutting down an instance will still sometimes shutdown another instance unintentionally.  I'll include a command line capture below to illustrate this.  I've tracked the problem down to the org.apache.activemq.console.command.ShutdownCommand's runTask method.  For some reason, execution drops down into the "Get the first broker only" section where some unintended broker is added to the list and shutdown.  With the commands below, I attempt to stop broker1.  The broker1 instance is stopped, but then broker2 is stopped also.

I haven't opened a Jira on this or the original issue since the scripts are new and I can't tell based on the docs I've read if I'm missing something in the instance configuration with the instance-specfic .activemqrc or activemq script.

Phil


[phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)

INFO: Invoke the following command to create a configuration file
/home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]

INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/home/phil/apache-activemq-5.4.1/broker1/data/activemq.pid' (pid '24202')

[phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
phil     24122 32.7 14.2 434856 146024 pts/3   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker2/conf;/home/phil/apache-activemq-5.4.1/broker2/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker2 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
phil     24202 72.2 14.1 434856 145560 pts/2   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
phil     24263  0.0  0.0   4200   700 pts/2    S+   11:33   0:00 grep java

[phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 stop
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)

INFO: Invoke the following command to create a configuration file
/home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]

INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '24202' : Java Runtime: Sun Microsystems Inc. 1.6.0_21 /usr/java/jdk1.6.0_21/jre
  Heap sizes: current=15552k  free=15188k  max=249472k
    JVM args: -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1
ACTIVEMQ_HOME: /home/phil/apache-activemq-5.4.1
ACTIVEMQ_BASE: /home/phil/apache-activemq-5.4.1/broker1
Connecting to pid: 24122
Stopping broker: broker2
..
INFO: Regular shutdown not successful,  sending SIGKILL to process with pid '24202'

[phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
phil     24356  0.0  0.0   4200   704 pts/2    S+   11:33   0:00 grep java


RE: Multiple instances with ActiveMQ 5.4.1

Posted by Phil Pickett <pp...@vmware.com>.
Hi Dejan,

Thanks a lot for creating the Jira and submitting the fix so quickly.  I had made the same change in the bin/activemq script to use $ACTIVEMQ_BASE for the ACTIVEMQ_CONFIG_DIR and ACTIVEMQ_DATA_DIR.  I've also rebuilt activemq-console and am using the new jar.

This allows multiple instances to start, but shutting down an instance will still sometimes shutdown another instance unintentionally.  I'll include a command line capture below to illustrate this.  I've tracked the problem down to the org.apache.activemq.console.command.ShutdownCommand's runTask method.  For some reason, execution drops down into the "Get the first broker only" section where some unintended broker is added to the list and shutdown.  With the commands below, I attempt to stop broker1.  The broker1 instance is stopped, but then broker2 is stopped also.

I haven't opened a Jira on this or the original issue since the scripts are new and I can't tell based on the docs I've read if I'm missing something in the instance configuration with the instance-specfic .activemqrc or activemq script.

Phil


[phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)

INFO: Invoke the following command to create a configuration file
/home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]

INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/home/phil/apache-activemq-5.4.1/broker1/data/activemq.pid' (pid '24202')

[phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
phil     24122 32.7 14.2 434856 146024 pts/3   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker2/conf;/home/phil/apache-activemq-5.4.1/broker2/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker2 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
phil     24202 72.2 14.1 434856 145560 pts/2   Sl   11:33   0:05 /usr/java/jdk1.6.0_21/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dcom.sun.management.jmxremote -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1 -jar /home/phil/apache-activemq-5.4.1/bin/run.jar start
phil     24263  0.0  0.0   4200   700 pts/2    S+   11:33   0:00 grep java

[phil@fedora11b apache-activemq-5.4.1]$ broker1/bin/broker1 stop
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /home/phil/.activemqrc)

INFO: Invoke the following command to create a configuration file
/home/phil/apache-activemq-5.4.1/bin/activemq setup [ /etc/default/activemq | /home/phil/.activemqrc ]

INFO: Using java '/usr/java/jdk1.6.0_21/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '24202' : Java Runtime: Sun Microsystems Inc. 1.6.0_21 /usr/java/jdk1.6.0_21/jre
  Heap sizes: current=15552k  free=15188k  max=249472k
    JVM args: -Dactivemq.classpath=/home/phil/apache-activemq-5.4.1/broker1/conf;/home/phil/apache-activemq-5.4.1/broker1/conf; -Dactivemq.home=/home/phil/apache-activemq-5.4.1 -Dactivemq.base=/home/phil/apache-activemq-5.4.1/broker1
ACTIVEMQ_HOME: /home/phil/apache-activemq-5.4.1
ACTIVEMQ_BASE: /home/phil/apache-activemq-5.4.1/broker1
Connecting to pid: 24122
Stopping broker: broker2
..
INFO: Regular shutdown not successful,  sending SIGKILL to process with pid '24202'

[phil@fedora11b apache-activemq-5.4.1]$ ps auxwww | grep java
phil     24356  0.0  0.0   4200   704 pts/2    S+   11:33   0:00 grep java


Re: Multiple instances with ActiveMQ 5.4.1

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Phil,

this should be now fixed. See
https://issues.apache.org/activemq/browse/AMQ-2975 for more details.
Thanks for reporting

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 Wed, Oct 13, 2010 at 6:06 PM, Phil Pickett <pp...@vmware.com> wrote:
> I'm seeing what I think may be some problems with multiple broker instances and AMQ 5.4.1.  I've checked the docs and haven't found much information on the new scripts.  Before I open a Jira or investigate/submit a patch, I wanted to make sure my assumptions aren't wrong.
>
> First of all, I'm trying to create and run multiple instances as follows:
>
> 1) Create the instances:
>
> $ cd /home/phil/apache-activemq-5.4.1
>
> $ bin/activemq create broker1
> $ bin/activemq setup ~/.activemqrc-instance-broker1
> $ ln -s activemq bin/activemq-instance-broker1
>
> $ bin/activemq create broker2
> $ bin/activemq setup ~/.activemqrc-instance-broker2
> $ ln -s activemq bin/activemq-instance-broker2
>
> 2) set unique ports for the instances in their conf/activemq.xml and conf/jetty.xml files as shown below:
>
> $ grep 16  broker[12]/conf/*.xml
> broker1/conf/activemq.xml:            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
> broker1/conf/jetty.xml:                    <property name="port" value="8161" />
> broker2/conf/activemq.xml:            <transportConnector name="openwire" uri="tcp://0.0.0.0:61626"/>
> broker2/conf/jetty.xml:                    <property name="port" value="8162" />
>
> When I try to start both brokers, I get a "Process with pid XXX is already running" message.  This is due to the pid file being created in $ACTIVEMQ_HOME/data rather than the instance's $ACTIVEMQ_BASE/data directory.
>
> For now, my questions are:
>
> 1) Should $ACTIVEMQ_HOME point to the AMQ installation directory and $ACTIVEMQ_BASE point to the specific instance directories?
>
> 2) What should be in the ~/.activemqrc-instance-<INSTANCENAME> files?  Should I set the $ACTIVEMQ_BASE here?  I tried this but it didn't seem to work.
>
> 3) Should $ACTIVEMQ_HOME/bin/activemq-instance-<INSTANCENAME> simply be a symbolic link to the ACTIVEMQ_HOME/bin/activemq script?
>
> 4) How should the instances be started?  Using the bin/activemq-instance-<INSTANCENAME>?  Or using <INSTANCENAME>/bin/<INSTANCENAME> (in my case, broker1/bin/broker1 if run from $ACTIVEMQ_HOME)
>
> Thanks,
>
> Phil
>

Multiple instances with ActiveMQ 5.4.1

Posted by Phil Pickett <pp...@vmware.com>.
I'm seeing what I think may be some problems with multiple broker instances and AMQ 5.4.1.  I've checked the docs and haven't found much information on the new scripts.  Before I open a Jira or investigate/submit a patch, I wanted to make sure my assumptions aren't wrong.

First of all, I'm trying to create and run multiple instances as follows:

1) Create the instances:

$ cd /home/phil/apache-activemq-5.4.1

$ bin/activemq create broker1
$ bin/activemq setup ~/.activemqrc-instance-broker1
$ ln -s activemq bin/activemq-instance-broker1

$ bin/activemq create broker2
$ bin/activemq setup ~/.activemqrc-instance-broker2
$ ln -s activemq bin/activemq-instance-broker2

2) set unique ports for the instances in their conf/activemq.xml and conf/jetty.xml files as shown below:

$ grep 16  broker[12]/conf/*.xml
broker1/conf/activemq.xml:            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
broker1/conf/jetty.xml:                    <property name="port" value="8161" />
broker2/conf/activemq.xml:            <transportConnector name="openwire" uri="tcp://0.0.0.0:61626"/>
broker2/conf/jetty.xml:                    <property name="port" value="8162" />

When I try to start both brokers, I get a "Process with pid XXX is already running" message.  This is due to the pid file being created in $ACTIVEMQ_HOME/data rather than the instance's $ACTIVEMQ_BASE/data directory.

For now, my questions are:

1) Should $ACTIVEMQ_HOME point to the AMQ installation directory and $ACTIVEMQ_BASE point to the specific instance directories?

2) What should be in the ~/.activemqrc-instance-<INSTANCENAME> files?  Should I set the $ACTIVEMQ_BASE here?  I tried this but it didn't seem to work.

3) Should $ACTIVEMQ_HOME/bin/activemq-instance-<INSTANCENAME> simply be a symbolic link to the ACTIVEMQ_HOME/bin/activemq script?

4) How should the instances be started?  Using the bin/activemq-instance-<INSTANCENAME>?  Or using <INSTANCENAME>/bin/<INSTANCENAME> (in my case, broker1/bin/broker1 if run from $ACTIVEMQ_HOME)

Thanks,

Phil

Re: multiple ajax clients in the same browser?

Posted by Alex Dean <al...@crackpot.org>.
On Oct 13, 2010, at 6:56 AM, Dejan Bosanac wrote:

> Just committed it. Thanks for the great work. More comments can be
> found in Jira.

Fantastic.  I would be willing to write some updates for http://activemq.apache.org/ajax.html.  We need to describe how to use selectors and clientId.  I tried the 'edit this page' link, but was told I don't have permissions to edit.  Can you grant that (my username is 'alexdean'), or describe how I should submit a patch/update for that page?

alex

Re: multiple ajax clients in the same browser?

Posted by Dejan Bosanac <de...@nighttale.net>.
Just committed it. Thanks for the great work. More comments can be
found in Jira.

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, Oct 11, 2010 at 8:36 PM, Alex Dean <al...@crackpot.org> wrote:
> No trouble.  Just wanted to keep it on the radar.
>
> On Oct 11, 2010, at 12:14 PM, Dejan Bosanac wrote:
>
>> Hi Alex,
>>
>> it was a busy week, so I didn't get to take a look at it yet. I'll try
>> to do it this week.
>>
>> 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, Oct 11, 2010 at 4:33 PM, Alex Dean <al...@crackpot.org> wrote:
>>> Has anyone had a chance to review this patch yet?  https://issues.apache.org/activemq/browse/AMQ-2948
>>>
>>> thanks,
>>> alex
>>>
>>> On Oct 1, 2010, at 8:38 AM, Alex Dean wrote:
>>>
>>>> Great, thanks Dejan.
>>>>
>>>> One issue I have noticed with this change:  Sometimes when I close a browser window which is using amq.js, I start seeing messages like this in my debugging log...
>>>>
>>>> DEBUG | message for ActiveMQMessageConsumer { value=ID:rutabaga.local-65016-1285865065176-4:3:1:1, started=true }continuation=org.eclipse.jetty.server.AsyncContinuation@267f59c7@IDLE,initial
>>>> DEBUG | Async client internal exception occurred with no exception listener registered: java.lang.IllegalStateException: IDLE,initial
>>>> java.lang.IllegalStateException: IDLE,initial
>>>>       at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
>>>>       at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:756)
>>>>       at org.apache.activemq.web.AjaxListener.onMessageAvailable(AjaxListener.java:50)
>>>>       at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1250)
>>>>       at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
>>>>       at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
>>>>       at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
>>>>       at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
>>>>
>>>> This is repeated periodically, until the cleanup Timer/TimerTask runs, then these messages cease.  It seems like maybe I need to be cleaning up the Continuation used by AjaxListener somehow?  The fact that this only happens for an abandoned web client, and is resolved when the cleanup thread runs, made me think it's not critical, but I'd still like to figure out why it's happening.
>>>>
>>>> alex
>>>>
>>>> On Oct 1, 2010, at 3:36 AM, Dejan Bosanac wrote:
>>>>
>>>>> Thanks Alex,
>>>>>
>>>>> I'll see to take a look at (and commit) it in the next couple of days.
>>>>>
>>>>>
>>>>> 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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
>>>>>> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>>>>>>
>>>>>> alex
>>>>>>
>>>>>> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>>>>>>
>>>>>>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>>>>>>
>>>>>>> https://issues.apache.org/activemq/browse/AMQ-2948
>>>>>>>
>>>>>>> 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 <al...@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 <al...@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
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Re: multiple ajax clients in the same browser?

Posted by Alex Dean <al...@crackpot.org>.
No trouble.  Just wanted to keep it on the radar.

On Oct 11, 2010, at 12:14 PM, Dejan Bosanac wrote:

> Hi Alex,
> 
> it was a busy week, so I didn't get to take a look at it yet. I'll try
> to do it this week.
> 
> 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, Oct 11, 2010 at 4:33 PM, Alex Dean <al...@crackpot.org> wrote:
>> Has anyone had a chance to review this patch yet?  https://issues.apache.org/activemq/browse/AMQ-2948
>> 
>> thanks,
>> alex
>> 
>> On Oct 1, 2010, at 8:38 AM, Alex Dean wrote:
>> 
>>> Great, thanks Dejan.
>>> 
>>> One issue I have noticed with this change:  Sometimes when I close a browser window which is using amq.js, I start seeing messages like this in my debugging log...
>>> 
>>> DEBUG | message for ActiveMQMessageConsumer { value=ID:rutabaga.local-65016-1285865065176-4:3:1:1, started=true }continuation=org.eclipse.jetty.server.AsyncContinuation@267f59c7@IDLE,initial
>>> DEBUG | Async client internal exception occurred with no exception listener registered: java.lang.IllegalStateException: IDLE,initial
>>> java.lang.IllegalStateException: IDLE,initial
>>>       at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
>>>       at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:756)
>>>       at org.apache.activemq.web.AjaxListener.onMessageAvailable(AjaxListener.java:50)
>>>       at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1250)
>>>       at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
>>>       at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
>>>       at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
>>>       at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
>>> 
>>> This is repeated periodically, until the cleanup Timer/TimerTask runs, then these messages cease.  It seems like maybe I need to be cleaning up the Continuation used by AjaxListener somehow?  The fact that this only happens for an abandoned web client, and is resolved when the cleanup thread runs, made me think it's not critical, but I'd still like to figure out why it's happening.
>>> 
>>> alex
>>> 
>>> On Oct 1, 2010, at 3:36 AM, Dejan Bosanac wrote:
>>> 
>>>> Thanks Alex,
>>>> 
>>>> I'll see to take a look at (and commit) it in the next couple of days.
>>>> 
>>>> 
>>>> 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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
>>>>> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>>>>> 
>>>>> alex
>>>>> 
>>>>> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>>>>> 
>>>>>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>>>>> 
>>>>>> https://issues.apache.org/activemq/browse/AMQ-2948
>>>>>> 
>>>>>> 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 <al...@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 <al...@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
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 


Re: multiple ajax clients in the same browser?

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Alex,

it was a busy week, so I didn't get to take a look at it yet. I'll try
to do it this week.

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, Oct 11, 2010 at 4:33 PM, Alex Dean <al...@crackpot.org> wrote:
> Has anyone had a chance to review this patch yet?  https://issues.apache.org/activemq/browse/AMQ-2948
>
> thanks,
> alex
>
> On Oct 1, 2010, at 8:38 AM, Alex Dean wrote:
>
>> Great, thanks Dejan.
>>
>> One issue I have noticed with this change:  Sometimes when I close a browser window which is using amq.js, I start seeing messages like this in my debugging log...
>>
>> DEBUG | message for ActiveMQMessageConsumer { value=ID:rutabaga.local-65016-1285865065176-4:3:1:1, started=true }continuation=org.eclipse.jetty.server.AsyncContinuation@267f59c7@IDLE,initial
>> DEBUG | Async client internal exception occurred with no exception listener registered: java.lang.IllegalStateException: IDLE,initial
>> java.lang.IllegalStateException: IDLE,initial
>>       at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
>>       at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:756)
>>       at org.apache.activemq.web.AjaxListener.onMessageAvailable(AjaxListener.java:50)
>>       at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1250)
>>       at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
>>       at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
>>       at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
>>       at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
>>
>> This is repeated periodically, until the cleanup Timer/TimerTask runs, then these messages cease.  It seems like maybe I need to be cleaning up the Continuation used by AjaxListener somehow?  The fact that this only happens for an abandoned web client, and is resolved when the cleanup thread runs, made me think it's not critical, but I'd still like to figure out why it's happening.
>>
>> alex
>>
>> On Oct 1, 2010, at 3:36 AM, Dejan Bosanac wrote:
>>
>>> Thanks Alex,
>>>
>>> I'll see to take a look at (and commit) it in the next couple of days.
>>>
>>>
>>> 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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
>>>> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>>>>
>>>> alex
>>>>
>>>> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>>>>
>>>>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>>>>
>>>>> https://issues.apache.org/activemq/browse/AMQ-2948
>>>>>
>>>>> 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 <al...@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 <al...@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
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
>

Re: multiple ajax clients in the same browser?

Posted by Alex Dean <al...@crackpot.org>.
Has anyone had a chance to review this patch yet?  https://issues.apache.org/activemq/browse/AMQ-2948

thanks,
alex

On Oct 1, 2010, at 8:38 AM, Alex Dean wrote:

> Great, thanks Dejan.
> 
> One issue I have noticed with this change:  Sometimes when I close a browser window which is using amq.js, I start seeing messages like this in my debugging log...
> 
> DEBUG | message for ActiveMQMessageConsumer { value=ID:rutabaga.local-65016-1285865065176-4:3:1:1, started=true }continuation=org.eclipse.jetty.server.AsyncContinuation@267f59c7@IDLE,initial
> DEBUG | Async client internal exception occurred with no exception listener registered: java.lang.IllegalStateException: IDLE,initial
> java.lang.IllegalStateException: IDLE,initial
> 	at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
> 	at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:756)
> 	at org.apache.activemq.web.AjaxListener.onMessageAvailable(AjaxListener.java:50)
> 	at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1250)
> 	at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
> 	at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
> 	at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
> 	at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)
> 
> This is repeated periodically, until the cleanup Timer/TimerTask runs, then these messages cease.  It seems like maybe I need to be cleaning up the Continuation used by AjaxListener somehow?  The fact that this only happens for an abandoned web client, and is resolved when the cleanup thread runs, made me think it's not critical, but I'd still like to figure out why it's happening.
> 
> alex
> 
> On Oct 1, 2010, at 3:36 AM, Dejan Bosanac wrote:
> 
>> Thanks Alex,
>> 
>> I'll see to take a look at (and commit) it in the next couple of days.
>> 
>> 
>> 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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
>>> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>>> 
>>> alex
>>> 
>>> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>>> 
>>>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>>> 
>>>> https://issues.apache.org/activemq/browse/AMQ-2948
>>>> 
>>>> 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 <al...@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 <al...@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
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
> 
> 


Re: multiple ajax clients in the same browser?

Posted by Alex Dean <al...@crackpot.org>.
Great, thanks Dejan.

One issue I have noticed with this change:  Sometimes when I close a browser window which is using amq.js, I start seeing messages like this in my debugging log...

DEBUG | message for ActiveMQMessageConsumer { value=ID:rutabaga.local-65016-1285865065176-4:3:1:1, started=true }continuation=org.eclipse.jetty.server.AsyncContinuation@267f59c7@IDLE,initial
DEBUG | Async client internal exception occurred with no exception listener registered: java.lang.IllegalStateException: IDLE,initial
java.lang.IllegalStateException: IDLE,initial
	at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
	at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:756)
	at org.apache.activemq.web.AjaxListener.onMessageAvailable(AjaxListener.java:50)
	at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1250)
	at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
	at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
	at org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:98)
	at org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:36)

This is repeated periodically, until the cleanup Timer/TimerTask runs, then these messages cease.  It seems like maybe I need to be cleaning up the Continuation used by AjaxListener somehow?  The fact that this only happens for an abandoned web client, and is resolved when the cleanup thread runs, made me think it's not critical, but I'd still like to figure out why it's happening.

alex

On Oct 1, 2010, at 3:36 AM, Dejan Bosanac wrote:

> Thanks Alex,
> 
> I'll see to take a look at (and commit) it in the next couple of days.
> 
> 
> 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 Thu, Sep 30, 2010 at 11:14 PM, Alex Dean <al...@crackpot.org> wrote:
>> I attached a new (and hopefully much-improved) patch to this ticket.  Reviews appreciated.
>> 
>> alex
>> 
>> On Sep 28, 2010, at 12:29 PM, Alex Dean wrote:
>> 
>>> I just submitted a patch to allow multiple windows in the same browser to send/receive messages via ajax.
>>> 
>>> https://issues.apache.org/activemq/browse/AMQ-2948
>>> 
>>> 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 <al...@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 <al...@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
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
>