use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testApplicationIdConversion.
public void testApplicationIdConversion() {
final String applicationId = "appId";
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setAppId(applicationId);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertEquals("Unexpected applicationId", applicationId, convertedMessage.getMessageHeader().getAppId());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class PropertyConverter_v0_8_to_InternalTest method testDeliveryModePersistentConversion.
public void testDeliveryModePersistentConversion() {
BasicContentHeaderProperties header = new BasicContentHeaderProperties();
header.setDeliveryMode(BasicContentHeaderProperties.PERSISTENT);
final AMQMessage originalMessage = createTestMessage(header);
InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
assertTrue("Unexpected persistence of message", convertedMessage.isPersistent());
assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class ManagementNode method sendResponse.
private void sendResponse(final InternalMessage message, final InternalMessage response) {
String replyTo = message.getMessageHeader().getReplyTo();
response.setInitialRoutingAddress(replyTo);
final MessageDestination responseDestination = getResponseDestination(replyTo);
RoutingResult<InternalMessage> result = responseDestination.route(response, replyTo, InstanceProperties.EMPTY);
result.send(new AutoCommitTransaction(_addressSpace.getMessageStore()), null);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class ManagementNode method processRequest.
private synchronized void processRequest(InternalMessage message) {
String id = (String) message.getMessageHeader().getHeader(IDENTITY_ATTRIBUTE);
String type = (String) message.getMessageHeader().getHeader(TYPE_ATTRIBUTE);
String operation = (String) message.getMessageHeader().getHeader(OPERATION_HEADER);
LOGGER.debug("Management Node identity: {}, type: {}, operation {}", id, type, operation);
InternalMessage response;
if (SELF_NODE_NAME.equals(id) && type.equals(MANAGEMENT_TYPE)) {
response = performManagementOperation(operation, message);
} else if (_managedTypes.containsKey(type)) {
response = performOperation(_managedTypes.get(type), operation, message);
} else {
response = createFailureResponse(message, STATUS_CODE_NOT_FOUND, "Unknown type {0}", type);
}
sendResponse(message, response);
}
use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.
the class ManagementNode method enqueue.
@Override
public void enqueue(final ServerMessage message, final Action<? super MessageInstance> action, final MessageEnqueueRecord record) {
@SuppressWarnings("unchecked") MessageConverter<ServerMessage, InternalMessage> converter = (MessageConverter<ServerMessage, InternalMessage>) MessageConverterRegistry.getConverter((message.getClass()), InternalMessage.class);
final InternalMessage msg = converter.convert(message, _addressSpace);
try {
if (action != null) {
action.performAction(new ConsumedMessageInstance(msg));
}
processRequest(msg);
} finally {
converter.dispose(msg);
}
}
Aggregations