Hey Rob.
The test is pretty simple. I've attached some code below. Basically we
create a durable consumer send some messages and wait till we get them
all. Then we destroy the consumer and send some more messages then
create another durable consumer with the same id and wait to get the
messages we sent while their was no consumer.
std::string subName = Guid().createGUID();
// Create CMS Object for Comms
cms::Session* session = testSupport.getSession();
cms::Topic* topic = session->createTopic(Guid::createGUIDString());
cms::MessageConsumer* consumer =
session->createDurableConsumer( topic, subName, "" );
consumer->setMessageListener( &testSupport );
cms::MessageProducer* producer =
session->createProducer( topic );
unsigned int sent;
// Send some text messages
sent = testSupport.produceTextMessages( *producer, 3 );
// Wait for all messages
testSupport.waitForMessages( sent );
unsigned int numReceived = testSupport.getNumReceived();
if( IntegrationCommon::debug ) {
printf("received: %d\n", numReceived );
}
CPPUNIT_ASSERT_EQUAL( sent, numReceived );
// Nuke the consumer
delete consumer;
// Send some text messages
sent += testSupport.produceTextMessages( *producer, 3 );
consumer = session->createDurableConsumer( topic, subName, "" );
consumer->setMessageListener( &testSupport );
// Send some text messages
sent += testSupport.produceTextMessages( *producer, 3 );
// Wait for all remaining messages
testSupport.waitForMessages( sent );
numReceived = testSupport.getNumReceived();
if( IntegrationCommon::debug ) {
printf("received: %d\n", numReceived );
}
CPPUNIT_ASSERT_EQUAL( sent, numReceived );
if( IntegrationCommon::debug ) {
printf("Shutting Down\n" );
}
delete producer;
delete consumer;
delete topic;
// Remove the subscription
session->unsubscribe( subName );
Rob Davies wrote:
> Hi Tim,
>
> what does your integration test do ? I would like to try reproduce
> this in a junit test case
>
>
> cheers,
>
> Rob
>
>
http://rajdavies.blogspot.com/>
>
>
> On Oct 25, 2007, at 8:07 PM, Timothy Bish wrote:
>
>> Hiram
>>
>> I'm testing out ActiveMQ-CPP against the 50 RC2 binary and when I run
>> our Durable Consumer Integration test I keep getting the error below
>> returned from the broker. I'm not sure what this means, any clues.
>> This test works fine on a 4.1.1 broker.
>>
>>
>>
>> 1) test: integration::connector::openwire::OpenwireDurableTest::test (F)
>> line:
>> 156
>> ../../../src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp
>>
>> assertion failed
>> - Expression: false
>> - *** BEGIN SERVER-SIDE STACK TRACE ***
>> Message: java.io.IOException: Failed to read to journal for: offset =
>> 2374, file = 1, size = -1, type = 0. Reason: java.io.IOException: Could
>> not locate data file data--1
>> Cause: 0x31
>> Exception Class java.lang.RuntimeException
>> *** END SERVER-SIDE STACK TRACE ***
>>
>> FILE:
>> ../../../src/main/activemq/connector/openwire/OpenWireConnector.cpp,
>> LINE: 1358
>>
>> FILE:
>> ../../../src/main/activemq/connector/openwire/OpenWireConnector.cpp,
>> LINE: 1372
>>
>> FILE:
>> ../../../src/main/activemq/connector/openwire/OpenWireConnector.cpp,
>> LINE: 847
>> FILE: ../../../src/main/activemq/core/ActiveMQSession.cpp, LINE:
>> 675
>> FILE: ../../../src/main/activemq/core/ActiveMQProducer.cpp,
>> LINE: 194
>> FILE: ../../../src/main/activemq/core/ActiveMQProducer.cpp,
>> LINE: 149
>> FILE: ../../../src/main/activemq/core/ActiveMQProducer.cpp,
>> LINE: 108
>> FILE: ../../../src/test-integration/integration/TestSupport.cpp,
>> LINE: 150
>>
>>
>> On Thu, 2007-10-25 at 12:43 -0400, Hiram Chirino wrote:
>>> Howdy folks.
>>>
>>> First I want to thank all the folks that helped test out the first
>>> release candidate. Several bugs/issues were identified and resolved.
>>> Now that things seem to have quieted down a bit, I cut a new release
>>> candidate. This one should be much more stable.
>>>
>>> You can get the binary distributions here:
>>>
http://people.apache.org/~chirino/apache-activemq-5.0.0-RC2/maven2/org/apache/activemq/apache-activemq/5.0.0/
>>>
>>> maven 2 repo:
>>>
http://people.apache.org/~chirino/apache-activemq-5.0.0-RC2/maven2>>> maven 1 repo:
>>>
http://people.apache.org/~chirino/apache-activemq-5.0.0-RC2/maven1>>>
>>> Please check out this build and let me know if you see anything out
>>> of place.
>>>
>>> --
>>> Regards,
>>> Hiram
>>>
>>> Blog:
http://hiramchirino.com>