use of org.apache.activemq.command.LocalTransactionId in project activemq-artemis by apache.
the class BrokerTest method testTransactedAckWithPrefetchOfOne.
public void testTransactedAckWithPrefetchOfOne() throws Exception {
// Setup a first connection
StubConnection connection1 = createConnection();
ConnectionInfo connectionInfo1 = createConnectionInfo();
SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
ProducerInfo producerInfo1 = createProducerInfo(sessionInfo1);
connection1.send(connectionInfo1);
connection1.send(sessionInfo1);
connection1.send(producerInfo1);
destination = createDestinationInfo(connection1, connectionInfo1, destinationType);
ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
consumerInfo1.setPrefetchSize(1);
connection1.send(consumerInfo1);
// Send the messages
for (int i = 0; i < 4; i++) {
Message message = createMessage(producerInfo1, destination, deliveryMode);
connection1.send(message);
}
// Now get the messages.
for (int i = 0; i < 4; i++) {
// Begin the transaction.
LocalTransactionId txid = createLocalTransaction(sessionInfo1);
connection1.send(createBeginTransaction(connectionInfo1, txid));
Message m1 = receiveMessage(connection1);
assertNotNull(m1);
MessageAck ack = createAck(consumerInfo1, m1, 1, MessageAck.STANDARD_ACK_TYPE);
ack.setTransactionId(txid);
connection1.send(ack);
// Commit the transaction.
connection1.send(createCommitTransaction1Phase(connectionInfo1, txid));
}
assertNoMessagesLeft(connection1);
}
use of org.apache.activemq.command.LocalTransactionId in project activemq-artemis by apache.
the class LocalTransactionIdTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
LocalTransactionId info = (LocalTransactionId) object;
info.setValue(1);
info.setConnectionId(createConnectionId("ConnectionId:1"));
}
use of org.apache.activemq.command.LocalTransactionId in project activemq-artemis by apache.
the class LocalTransactionIdTest method createObject.
@Override
public Object createObject() throws Exception {
LocalTransactionId info = new LocalTransactionId();
populateObject(info);
return info;
}
use of org.apache.activemq.command.LocalTransactionId in project activemq-artemis by apache.
the class LocalTransactionIdTest method createObject.
@Override
public Object createObject() throws Exception {
LocalTransactionId info = new LocalTransactionId();
populateObject(info);
return info;
}
use of org.apache.activemq.command.LocalTransactionId in project activemq-artemis by apache.
the class LocalTransactionIdTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
LocalTransactionId info = (LocalTransactionId) object;
info.setValue(1);
info.setConnectionId(createConnectionId("ConnectionId:1"));
}
Aggregations