You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Andy Piper <an...@bea.com> on 2006/09/28 13:26:50 UTC

Trouble with Store and Forward

Hello, we are having some problems with store-and-forward in specific
scenarios.

The consumer is setup like this:

try {
    BrokerService broker = new BrokerService();
    // set persistence
    broker.setUseJmx(true);
    broker.addConnector("tcp:localhost:61616");  // Admin side listening
port
} catch (Exception ex) {
    // ...
}

the producer like this:

try {
    BorkerService borker = new BrokerService();
    // set persistence
    broker.addConnector("tcp:localhost:61615"); // Managed side listenning
port, or we can
                                                // use vm transport if in
same VM.
    DiscoveryNetworkConnector nc = new DiscoveryNetworkConnector();
    nc.setUri(new URI("static:(tcp://localhost:61616)"));
    nc.setFailover(true);
    nc.addStaticallyIncludedDestination(new ActiveMQQueue("QUEUE.DEFAULT"));
// Forward specified Queue
    broker.addNetworkConnector(nc);
    broker.start();
} catch (Exception ex) {
    // ...
}

and we send messages like this:

// user = ActiveMQConnection.DEFAULT_USER;
// pwd = ActiveMQConnection.DEFAULT_PASSWORD;
// url = failover:tcp://localhost:61615
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(user, pwd, url);
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue("QUEUE.DEFAULT");
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Persistent
TextMessage tm =
session.createTextMessage("jms-domain-log-prototype-embedded");
producer.send(tm);
session.close();
connection.close();

This works well if we stop and start the producer. However if we stop and
start the consumer it fails to reconnect - we end up having to stop and
start the producer as well.

We also tried using the JMS-JMS bridge like this:

// Insert following codes before broker start.
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL("failover:tcp://localhost:61616");
OutboundQueueBridge oqb = new OutboundQueueBridge();
oqb.setOutboundQueueName("QUEUE.DEFAULT");
JmsQueueConnector jc = new JmsQueueConnector();
jc.setOutboundQueueBridges(new OutboundQueueBridge[]{oqb});
jc.setOutboundQueueConnectionFactory(factory);
broker.addJmsConnector(jc);

but this has the unfortunate side effect of needing the consumer to be
started first.

Any thoughts appreciated.

I believe this is AMQ 4

andy
-- 
View this message in context: http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6544577
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Trouble with Store and Forward

Posted by James Strachan <ja...@gmail.com>.
On 10/11/06, Andy Piper <an...@bea.com> wrote:
>
> I've raised an issue with a reproducer attached from our developer.
>
> https://issues.apache.org/activemq/browse/AMQ-968

Great stuff, thanks Andy!


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Trouble with Store and Forward

Posted by Andy Piper <an...@bea.com>.
I've raised an issue with a reproducer attached from our developer.

https://issues.apache.org/activemq/browse/AMQ-968



James.Strachan wrote:
> 
> It might be worth trying to reproduce on 4.0.2 and if you can then yes
> if its not too much trouble please submit a test case and it sounds
> like it could be a bug.
> 
> 

Thanks!

andy
-- 
View this message in context: http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6756408
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Trouble with Store and Forward

Posted by James Strachan <ja...@gmail.com>.
On 9/29/06, Andy Piper <an...@bea.com> wrote:
>
> Its 4.0. We can probably cook up a reprodcuer if you thik it sounds like a
> bug.

It might be worth trying to reproduce on 4.0.2 and if you can then yes
if its not too much trouble please submit a test case and it sounds
like it could be a bug.

>
> andy
>
>
> James.Strachan wrote:
> >
> > BTW any idea the exact version of AMQ4? There's been a few in the last
> > year or so :).
> >
> > You don't happen to have a little test case that demonstrates the
> > problem do you by any chance?
> >
> > On 9/28/06, Andy Piper <an...@bea.com> wrote:
> >>
> >> Hello, we are having some problems with store-and-forward in specific
> >> scenarios.
> >>
> >> The consumer is setup like this:
> >>
> >> try {
> >>     BrokerService broker = new BrokerService();
> >>     // set persistence
> >>     broker.setUseJmx(true);
> >>     broker.addConnector("tcp:localhost:61616");  // Admin side listening
> >> port
> >> } catch (Exception ex) {
> >>     // ...
> >> }
> >>
> >> the producer like this:
> >>
> >> try {
> >>     BorkerService borker = new BrokerService();
> >>     // set persistence
> >>     broker.addConnector("tcp:localhost:61615"); // Managed side
> >> listenning
> >> port, or we can
> >>                                                 // use vm transport if in
> >> same VM.
> >>     DiscoveryNetworkConnector nc = new DiscoveryNetworkConnector();
> >>     nc.setUri(new URI("static:(tcp://localhost:61616)"));
> >>     nc.setFailover(true);
> >>     nc.addStaticallyIncludedDestination(new
> >> ActiveMQQueue("QUEUE.DEFAULT"));
> >> // Forward specified Queue
> >>     broker.addNetworkConnector(nc);
> >>     broker.start();
> >> } catch (Exception ex) {
> >>     // ...
> >> }
> >>
> >> and we send messages like this:
> >>
> >> // user = ActiveMQConnection.DEFAULT_USER;
> >> // pwd = ActiveMQConnection.DEFAULT_PASSWORD;
> >> // url = failover:tcp://localhost:61615
> >> ActiveMQConnectionFactory connectionFactory = new
> >> ActiveMQConnectionFactory(user, pwd, url);
> >> Connection connection = connectionFactory.createConnection();
> >> connection.start();
> >> Session session = connection.createSession(false,
> >> Session.AUTO_ACKNOWLEDGE);
> >> Destination destination = session.createQueue("QUEUE.DEFAULT");
> >> MessageProducer producer = session.createProducer(destination);
> >> producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Persistent
> >> TextMessage tm =
> >> session.createTextMessage("jms-domain-log-prototype-embedded");
> >> producer.send(tm);
> >> session.close();
> >> connection.close();
> >>
> >> This works well if we stop and start the producer. However if we stop and
> >> start the consumer it fails to reconnect - we end up having to stop and
> >> start the producer as well.
> >>
> >> We also tried using the JMS-JMS bridge like this:
> >>
> >> // Insert following codes before broker start.
> >> ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
> >> factory.setBrokerURL("failover:tcp://localhost:61616");
> >> OutboundQueueBridge oqb = new OutboundQueueBridge();
> >> oqb.setOutboundQueueName("QUEUE.DEFAULT");
> >> JmsQueueConnector jc = new JmsQueueConnector();
> >> jc.setOutboundQueueBridges(new OutboundQueueBridge[]{oqb});
> >> jc.setOutboundQueueConnectionFactory(factory);
> >> broker.addJmsConnector(jc);
> >>
> >> but this has the unfortunate side effect of needing the consumer to be
> >> started first.
> >>
> >> Any thoughts appreciated.
> >>
> >> I believe this is AMQ 4
> >>
> >> andy
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6544577
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6564622
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Trouble with Store and Forward

Posted by Andy Piper <an...@bea.com>.
Its 4.0. We can probably cook up a reprodcuer if you thik it sounds like a
bug.

andy


James.Strachan wrote:
> 
> BTW any idea the exact version of AMQ4? There's been a few in the last
> year or so :).
> 
> You don't happen to have a little test case that demonstrates the
> problem do you by any chance?
> 
> On 9/28/06, Andy Piper <an...@bea.com> wrote:
>>
>> Hello, we are having some problems with store-and-forward in specific
>> scenarios.
>>
>> The consumer is setup like this:
>>
>> try {
>>     BrokerService broker = new BrokerService();
>>     // set persistence
>>     broker.setUseJmx(true);
>>     broker.addConnector("tcp:localhost:61616");  // Admin side listening
>> port
>> } catch (Exception ex) {
>>     // ...
>> }
>>
>> the producer like this:
>>
>> try {
>>     BorkerService borker = new BrokerService();
>>     // set persistence
>>     broker.addConnector("tcp:localhost:61615"); // Managed side
>> listenning
>> port, or we can
>>                                                 // use vm transport if in
>> same VM.
>>     DiscoveryNetworkConnector nc = new DiscoveryNetworkConnector();
>>     nc.setUri(new URI("static:(tcp://localhost:61616)"));
>>     nc.setFailover(true);
>>     nc.addStaticallyIncludedDestination(new
>> ActiveMQQueue("QUEUE.DEFAULT"));
>> // Forward specified Queue
>>     broker.addNetworkConnector(nc);
>>     broker.start();
>> } catch (Exception ex) {
>>     // ...
>> }
>>
>> and we send messages like this:
>>
>> // user = ActiveMQConnection.DEFAULT_USER;
>> // pwd = ActiveMQConnection.DEFAULT_PASSWORD;
>> // url = failover:tcp://localhost:61615
>> ActiveMQConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory(user, pwd, url);
>> Connection connection = connectionFactory.createConnection();
>> connection.start();
>> Session session = connection.createSession(false,
>> Session.AUTO_ACKNOWLEDGE);
>> Destination destination = session.createQueue("QUEUE.DEFAULT");
>> MessageProducer producer = session.createProducer(destination);
>> producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Persistent
>> TextMessage tm =
>> session.createTextMessage("jms-domain-log-prototype-embedded");
>> producer.send(tm);
>> session.close();
>> connection.close();
>>
>> This works well if we stop and start the producer. However if we stop and
>> start the consumer it fails to reconnect - we end up having to stop and
>> start the producer as well.
>>
>> We also tried using the JMS-JMS bridge like this:
>>
>> // Insert following codes before broker start.
>> ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
>> factory.setBrokerURL("failover:tcp://localhost:61616");
>> OutboundQueueBridge oqb = new OutboundQueueBridge();
>> oqb.setOutboundQueueName("QUEUE.DEFAULT");
>> JmsQueueConnector jc = new JmsQueueConnector();
>> jc.setOutboundQueueBridges(new OutboundQueueBridge[]{oqb});
>> jc.setOutboundQueueConnectionFactory(factory);
>> broker.addJmsConnector(jc);
>>
>> but this has the unfortunate side effect of needing the consumer to be
>> started first.
>>
>> Any thoughts appreciated.
>>
>> I believe this is AMQ 4
>>
>> andy
>> --
>> View this message in context:
>> http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6544577
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6564622
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Trouble with Store and Forward

Posted by James Strachan <ja...@gmail.com>.
BTW any idea the exact version of AMQ4? There's been a few in the last
year or so :).

You don't happen to have a little test case that demonstrates the
problem do you by any chance?

On 9/28/06, Andy Piper <an...@bea.com> wrote:
>
> Hello, we are having some problems with store-and-forward in specific
> scenarios.
>
> The consumer is setup like this:
>
> try {
>     BrokerService broker = new BrokerService();
>     // set persistence
>     broker.setUseJmx(true);
>     broker.addConnector("tcp:localhost:61616");  // Admin side listening
> port
> } catch (Exception ex) {
>     // ...
> }
>
> the producer like this:
>
> try {
>     BorkerService borker = new BrokerService();
>     // set persistence
>     broker.addConnector("tcp:localhost:61615"); // Managed side listenning
> port, or we can
>                                                 // use vm transport if in
> same VM.
>     DiscoveryNetworkConnector nc = new DiscoveryNetworkConnector();
>     nc.setUri(new URI("static:(tcp://localhost:61616)"));
>     nc.setFailover(true);
>     nc.addStaticallyIncludedDestination(new ActiveMQQueue("QUEUE.DEFAULT"));
> // Forward specified Queue
>     broker.addNetworkConnector(nc);
>     broker.start();
> } catch (Exception ex) {
>     // ...
> }
>
> and we send messages like this:
>
> // user = ActiveMQConnection.DEFAULT_USER;
> // pwd = ActiveMQConnection.DEFAULT_PASSWORD;
> // url = failover:tcp://localhost:61615
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(user, pwd, url);
> Connection connection = connectionFactory.createConnection();
> connection.start();
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> Destination destination = session.createQueue("QUEUE.DEFAULT");
> MessageProducer producer = session.createProducer(destination);
> producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Persistent
> TextMessage tm =
> session.createTextMessage("jms-domain-log-prototype-embedded");
> producer.send(tm);
> session.close();
> connection.close();
>
> This works well if we stop and start the producer. However if we stop and
> start the consumer it fails to reconnect - we end up having to stop and
> start the producer as well.
>
> We also tried using the JMS-JMS bridge like this:
>
> // Insert following codes before broker start.
> ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
> factory.setBrokerURL("failover:tcp://localhost:61616");
> OutboundQueueBridge oqb = new OutboundQueueBridge();
> oqb.setOutboundQueueName("QUEUE.DEFAULT");
> JmsQueueConnector jc = new JmsQueueConnector();
> jc.setOutboundQueueBridges(new OutboundQueueBridge[]{oqb});
> jc.setOutboundQueueConnectionFactory(factory);
> broker.addJmsConnector(jc);
>
> but this has the unfortunate side effect of needing the consumer to be
> started first.
>
> Any thoughts appreciated.
>
> I believe this is AMQ 4
>
> andy
> --
> View this message in context: http://www.nabble.com/Trouble-with-Store-and-Forward-tf2350313.html#a6544577
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/