use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class ManagementNodeConsumer method enqueue.
@Override
public void enqueue(final ServerMessage message, final Action<? super MessageInstance> action, final MessageEnqueueRecord record) {
final InternalMessage internalMessage = (InternalMessage) message;
final ManagementResponse responseEntry = new ManagementResponse(this, internalMessage);
send(responseEntry);
if (action != null) {
action.performAction(responseEntry);
}
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class JDBCMessageStoreTest method testEnqueueTransactionCommitAsync.
public void testEnqueueTransactionCommitAsync() throws Exception {
final String queueName = getTestName();
final UUID transactionalLogId = UUID.randomUUID();
final MessageStore store = getStore();
final TransactionLogResource transactionalLog = mockTransactionLogResource(transactionalLogId, queueName);
final InternalMessage message = addTestMessage(store, queueName, "test");
final Transaction transaction = store.newTransaction();
final MessageEnqueueRecord record = transaction.enqueueMessage(transactionalLog, message);
assertNotNull("Message enqueue record should not be null", record);
assertEquals("Unexpected queue id", transactionalLogId, record.getQueueId());
assertEquals("Unexpected message number", message.getMessageNumber(), record.getMessageNumber());
final ListenableFuture<Void> future = transaction.commitTranAsync(null);
future.get(1000, TimeUnit.MILLISECONDS);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class JDBCMessageStoreTest method testDequeueTransactionCommitAsync.
public void testDequeueTransactionCommitAsync() throws Exception {
final String queueName = getTestName();
final UUID transactionalLogId = UUID.randomUUID();
final MessageStore store = getStore();
final TransactionLogResource transactionalLog = mockTransactionLogResource(transactionalLogId, queueName);
final InternalMessage message = addTestMessage(store, queueName, "test2");
final Transaction enqueueTransaction = store.newTransaction();
MessageEnqueueRecord record = enqueueTransaction.enqueueMessage(transactionalLog, message);
enqueueTransaction.commitTran();
final Transaction dequeueTransaction = store.newTransaction();
dequeueTransaction.dequeueMessage(record);
final ListenableFuture<Void> future = dequeueTransaction.commitTranAsync(null);
future.get(1000, TimeUnit.MILLISECONDS);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testNoBodyWithUnknownMessageAnnotation.
public void testNoBodyWithUnknownMessageAnnotation() throws Exception {
Message_1_0 sourceMessage = createTestMessage(new MessageAnnotations(Collections.singletonMap(Symbol.valueOf("x-opt-jms-msg-type"), (byte) 11)), null);
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", null, convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content", null, convertedMessage.getMessageBody());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class MessageConverter_v1_0_to_InternalTest method testAmqpValueWithAmqpType.
public void testAmqpValueWithAmqpType() throws Exception {
final Date originalValue = new Date();
final AmqpValue amqpValue = new AmqpValue(originalValue);
Properties properties = new Properties();
final String mimeType = "foo/bar";
properties.setContentType(Symbol.valueOf(mimeType));
Message_1_0 sourceMessage = createTestMessage(properties, amqpValue.createEncodingRetainingSection());
final InternalMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
assertEquals("Unexpected mime type", mimeType, convertedMessage.getMessageHeader().getMimeType());
assertEquals("Unexpected content", originalValue, convertedMessage.getMessageBody());
}
Aggregations