activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alf E. Helseth (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQ-895) JMS to JMS Bridge never reconnects under remote broker restarts.
Date Wed, 18 Apr 2007 06:59:35 GMT

    [ https://issues.apache.org/activemq/browse/AMQ-895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39022
] 

Alf E. Helseth commented on AMQ-895:
------------------------------------

Thanks Manuel for your patient replies!

I think I've been a bit unclear about this and how the problems I discover occurs. I'll try
to clearify:
I'm trying to bridge from AMQ to JCAPS, one queue as outbound, and one queue to be bridged
the opposite direction, from JCAPS to AMQ (setting it up as AMQ inbound queue). Here is a
snippet from the activemq.xml-file:

<jmsBridgeConnectors>
    <jmsQueueConnector
      outboundQueueConnectionFactory="#remoteFactory">
      <inboundQueueBridges>
        <inboundQueueBridge
          inboundQueueName="quBridgeFromJCAPS" />
      </inboundQueueBridges>
      <outboundQueueBridges>
        <outboundQueueBridge
          outboundQueueName="quBridgeToJCAPS" />
      </outboundQueueBridges>
    </jmsQueueConnector>
  </jmsBridgeConnectors>
...
  <bean id="remoteFactory"
     class="com.stc.jms.client.STCQueueConnectionFactory">
    <constructor-arg value="localhost"/>
    <constructor-arg value="18007"/>
  </bean>
 

Now for tesing both the AMQ broker and the JCAPS broker is running on localhost.

I've made simple "clients" to send messages to the local brokers, one for AMQ and one for
JCAPS. They both send jmx.jms.TextMessages. Here is a snippet of the clients:

    /**
     * Put a message on a STC queue
     * @author alfeh Mar 9, 2007
     */
    private void sendMsg() throws Exception {
        QueueConnectionFactory qcf = new STCQueueConnectionFactory("localhost", 18007);
        conn = qcf.createQueueConnection();
        conn.start();
        QueueSession sess = conn.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
        Queue q = sess.createQueue("quTest1");
        QueueSender sender = sess.createSender(q);
        TextMessage msg = sess.createTextMessage("Hello to the world!!!");
        msg.getText();
        sender.send(msg);
        sess.commit();
        System.out.println("Sendt message '" + msg.getText() + "'");
        sess.close();
        conn.close();
    }


    /**
     * Put a message on a AMQ queue
     * @author alfeh Mar 9, 2007
     */
    private void sendMsg() throws Exception {
        conn = ActiveMQConnection.makeConnection("tcp://localhost:62616");
        conn.start();
        QueueSession sess = conn.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
        Queue q = sess.createQueue("quBridgeToJCAPS");
        QueueSender sender = sess.createSender(q);
        TextMessage msg = sess.createTextMessage("Hello to the world!!!");
        msg.getText();
        sender.send(msg);
        sess.commit();
        System.out.println("Sendt message '" + msg.getText() + "'");
        sess.close();
        conn.close();
    }


Pretty simple and stright-forward I think, and seems to be working OK regarding posting the
messages to the "local" brokers.
In addittion, I can send messages to the AMQ broker via the JMXConsole, and the JCAPS broker
has its own WEB GUI (Enterprise Manager), and it can be used for sending and reading messages
on that broker.

When I fire it all up (first the JCAPS broker then the AMQ broker) it all seems OK.
The AMQ's inbound bridge queue (quBridgeFromJCAPS) is created inside the JCAPS broker upon
first startup of AMQ.

The problem occurs after successfully posting a message onto that queue on the JCAPS broker.
AMQ seems to try to bridge it into the AMQ's quBridgeFromJCAPS, causing the exception to be
thrown from inside the AMQ code. No message arrives to the AMQ queue, but seems to be thrown
back to the JCAPS queue (which ends up with two copies of that same message). The exception
is shown in a previous post, and is thrown from line 1505 in class ActiveMQSession.
Here is a snippet of that code:

    /**
     * Sends the message for dispatch by the broker.
     * 
     * @param producer -
     *            message producer.
     * @param destination -
     *            message destination.
     * @param message -
     *            message to be sent.
     * @param deliveryMode -
     *            JMS messsage delivery mode.
     * @param priority -
     *            message priority.
     * @param timeToLive -
     *            message expiration.
     * @throws JMSException
     */
    protected void send(ActiveMQMessageProducer producer, ActiveMQDestination destination,
Message message, int deliveryMode,
            int priority, long timeToLive) throws JMSException {
        checkClosed();

        if( destination.isTemporary() && connection.isDeleted(destination) ) {
            throw new JMSException("Cannot publish to a deleted Destination: "+destination);
        }

        // tell the Broker we are about to start a new transaction
        doStartTransaction();
        TransactionId txid = transactionContext.getTransactionId();
        
        message.setJMSDestination(destination); // (###### This is line 1505, here is the
exception thrown! ###)
        message.setJMSDeliveryMode(deliveryMode);        
        long expiration = 0L;

        if (!producer.getDisableMessageTimestamp()) {
            long timeStamp = System.currentTimeMillis();
            message.setJMSTimestamp(timeStamp);
            if (timeToLive > 0) {
                expiration = timeToLive + timeStamp;
            }
        }
.....




If I on the other hand try to send a message into the AMQ broker's outbound queue (quBridgeToJCAPS)
(e.g with the JMXConsole) it imidiately shows up in the JCAPS broker (queue with the same
name) and the contents seems OK.

See ? 50% success... would like to reach 100%...!

Any ideas?

Br
-Alf


> JMS to JMS Bridge never reconnects under remote broker restarts.
> ----------------------------------------------------------------
>
>                 Key: AMQ-895
>                 URL: https://issues.apache.org/activemq/browse/AMQ-895
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 4.0 RC2, 4.0.1
>            Reporter: Manuel Teira
>         Attachments: test_patch.diff
>
>
> I'm using ActiveMQ (4.0.1) JMS to JMS Bridge functionality to connect to a  SunMQ JMS
Broker (3.6 SP3  (Build 02-A)). I'm using two queues, an input and an output one, with the
following configuration:
>     <jmsBridgeConnectors>
>       <jmsQueueConnector outboundQueueConnectionFactory="#REMOTE">
>       <outboundQueueBridges>
>         <outboundQueueBridge outboundQueueName="SUNRECV"/>
>       </outboundQueueBridges>
>       <inboundQueueBridges>
>         <inboundQueueBridge inboundQueueName="SUNSEND"/>
>       </inboundQueueBridges>
>       </jmsQueueConnector>
>     </jmsBridgeConnectors>
> The system works really well until the SunMQ broker needed to be restarted. This is what
I found:
> 1.-ActiveMQ is not aware of the remote broker shutdown. I waited for a while, but no
log on ActiveMQ indicates knowledge about the new situation.
> 2.-When I send a message to the output queue SUNRECV, ActiveMQ complains that the producer
is closed:
> [ERROR][2006/08/25.09:47:12.039][ActiveMQ Session Task]failed to forward message: ActiveMQTextMessage
{commandId = 5, responseRequired = false, messageId = ID:trabucco-43457-1156491843149-3:4:1:1:1,
originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-43457-1156491843149-3:4:1:1,
destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156492032027,
arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority
= 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter
= 0, size = 2, properties = null, readOnlyProperties = true, readOnlyBody = true, text = 1}([C4064]:
Cannot perform operation, producer is closed.)
>  After this, it is automatically queueing messages without sending them, showing the
log:
> [DEBUG][2006/08/25.09:47:42.721][RMI TCP Connection(4)-10.95.89.20]No subscriptions registered,
will not dispatch message at this time.
>  Even if SunMQ is started again, ActiveMQ is not detecting the new situation, and continues
queueing messages sent to SUNRECV.
> Please, make me know if more information is needed to understand the situation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message