You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Chris Hofstaedter <ch...@nmwco.com> on 2007/05/09 14:51:53 UTC

Possible to Trade an In-Memory Queue between producer instances with embedded brokers?

I'm using 4.0.2 on various Windows machines.

 

I've got a producer with an embedded broker with a
MemoryPersistenceAdapter wrapped in a Log4J appender.  At times, the
log4j.xml file may change in ways that affect the way the
producer/embedded broker are configured.  When the change is detected,
Log4J will destroy and recreate the appender instance.  This results in
all of my in-queue messages being lost.

 

Unfortunately, making the embedded broker actually persist to disk not
an option for me.

 

I'd like to find a way to swap the local memory queue from the embedded
broker associated with the old producer instance to the one associated
with the new (after config change) producer instance.

 

I've tried simply calling setPersistenceAdapter() on the new broker with
the old broker's PersistenceAdapter and then resetting the old broker's
PersistenceAdapter to a new instance, but this didn't seem to work for
me.  

 

Is what I am doing possible the way I am trying to do it?  Should I
instead be trying to leave the old broker intact and update its
configuration in place (i.e. by removing the old
DiscoveryNetworkConnector and assigning a new one, etc).

 

I'm just looking for some general guidance or a pointer to somewhere in
the docs where this is covered.

 

-- Chris

 

 


Re: Possible to Trade an In-Memory Queue between producer instances with embedded brokers?

Posted by James Strachan <ja...@gmail.com>.
On 5/9/07, Chris Hofstaedter <ch...@nmwco.com> wrote:
> I'm using 4.0.2 on various Windows machines.
>
>
>
> I've got a producer with an embedded broker with a
> MemoryPersistenceAdapter wrapped in a Log4J appender.  At times, the
> log4j.xml file may change in ways that affect the way the
> producer/embedded broker are configured.  When the change is detected,
> Log4J will destroy and recreate the appender instance.  This results in
> all of my in-queue messages being lost.
>
>
>
> Unfortunately, making the embedded broker actually persist to disk not
> an option for me.
>
>
>
> I'd like to find a way to swap the local memory queue from the embedded
> broker associated with the old producer instance to the one associated
> with the new (after config change) producer instance.

By default when using the vm:// transport the broker is started up
when the first connection is created; then destroyed when the last
connection closes. If you don't want that - e.g. you want to run an
embedded broker for the duration of your process - just explicitly
create one up front on startup...

http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html

-- 
James
-------
http://macstrac.blogspot.com/