activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "javier (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (AMQ-2766) lost messages using jdbcPersistenceAdapter and mysql
Date Tue, 08 Jun 2010 12:16:52 GMT

    [ https://issues.apache.org/activemq/browse/AMQ-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59981#action_59981
] 

javier edited comment on AMQ-2766 at 6/8/10 8:16 AM:
-----------------------------------------------------

here the modified code:

public class JmsDurableTopicTransactionTest extends JmsTopicTransactionTest {

    /**
     * see JmsTransactionTestSupport#getJmsResourceProvider()
     */
    protected JmsResourceProvider getJmsResourceProvider() {
        JmsResourceProvider provider = new JmsResourceProvider();
        provider.setTopic(true);
  
       provider.setServerUri("tcp://localhost:61616");

        provider.setDeliveryMode(DeliveryMode.PERSISTENT);
        provider.setClientID(getClass().getName());
        provider.setDurableName(getName());
        return provider;
    }

}








public abstract class JmsTransactionTestSupport extends TestSupport implements MessageListener
{

......

    public void testReceiveRollback() throws Exception {
        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second
Message")};

        // lets consume any outstanding messages from prev test runs
        beginTx();
        while (consumer.receive(1000) != null) {
        }
        commitTx();

        // sent both messages
        beginTx();
        producer.send(outbound[0]);
        producer.send(outbound[1]);
        commitTx();

        
        LOG.info("Sent 0: " + outbound[0]);
        LOG.info("Sent 1: " + outbound[1]);

        ArrayList<Message> messages = new ArrayList<Message>();
        beginTx();
        Message message = consumer.receive(1000);
        messages.add(message);
        assertEquals(outbound[0], message);
        commitTx();

        // rollback so we can get that last message again.
        beginTx();
        message = consumer.receive(1000);
        if(message != null){
        	assertNotNull(message);
        	assertEquals(outbound[1], message);
        	rollbackTx();
        }

// ----------------------------
// this reconnect shouldn't cause any prob

        reconnect();
// ----------------------------
       
        // Consume again.. the prev message should
        // get redelivered.
        beginTx();
        message = consumer.receive(5000);
        assertNotNull("Should have re-received the message again!", message);
        messages.add(message);
        commitTx();

        Message inbound[] = new Message[messages.size()];
        messages.toArray(inbound);
        assertTextMessagesEqual("Rollback did not work", outbound, inbound);
    }
    

....

  
> lost messages using jdbcPersistenceAdapter and mysql
> ----------------------------------------------------
>
>                 Key: AMQ-2766
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2766
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.3.0, 5.3.1, 5.3.2
>         Environment: ubuntu
>            Reporter: javier
>
> hi,
> i was trying durable topics with jdbcPersistenceAdapter and mysql using JmsDurableTopicTransactionTest
 class (activemq test sources) and modified the connection and the method testReceiveRollback
adding a reconnect after the rollback. it should be work fine but it fails and i'm not sure
if i'm doing something wrong or is a bug.
> i would appreciate someone can check this test with this little modification
> javier

-- 
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