activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Trouble with Store and Forward
Date Thu, 28 Sep 2006 11:44:54 GMT
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 <andyp@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/

Mime
View raw message