[
https://issues.apache.org/jira/browse/ARTEMIS-1498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350102#comment-16350102
]
ASF GitHub Bot commented on ARTEMIS-1498:
-----------------------------------------
Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1793#discussion_r165606383
--- Diff:
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
---
@@ -128,389 +110,159 @@ public Object
outbound(org.apache.activemq.artemis.api.core.Message message, int
final WireFormat marshaller,
final CoreMessageObjectPools coreMessageObjectPools) throws Exception {
- final CoreMessage coreMessage = new CoreMessage(-1,
messageSend.getSize(), coreMessageObjectPools);
+ final OpenWireMessage openwireMessage = new OpenWireMessage(-1,
messageSend.getSize(), coreMessageObjectPools);
final String type = messageSend.getType();
if (type != null) {
- coreMessage.putStringProperty(JMS_TYPE_PROPERTY, new
SimpleString(type));
+ openwireMessage.putStringProperty(JMS_TYPE_PROPERTY, new
SimpleString(type));
}
- coreMessage.setDurable(messageSend.isPersistent());
- coreMessage.setExpiration(messageSend.getExpiration());
- coreMessage.setPriority(messageSend.getPriority());
- coreMessage.setTimestamp(messageSend.getTimestamp());
-
- final byte coreType = toCoreType(messageSend.getDataStructureType());
- coreMessage.setType(coreType);
+ openwireMessage.setMessageSize(messageSend.getSize());
+ openwireMessage.setDurable(messageSend.isPersistent());
+ openwireMessage.setExpiration(messageSend.getExpiration());
+ openwireMessage.setPriority(messageSend.getPriority());
+ openwireMessage.setTimestamp(messageSend.getTimestamp());
- final ActiveMQBuffer body = coreMessage.getBodyBuffer();
+ final byte coreType =
OpenWireCoreConverter.toCoreType(messageSend.getDataStructureType());
+ openwireMessage.setType(coreType);
- final ByteSequence contents = messageSend.getContent();
- if (contents == null && coreType ==
org.apache.activemq.artemis.api.core.Message.TEXT_TYPE) {
- body.writeNullableString(null);
- } else if (contents != null) {
- final boolean messageCompressed = messageSend.isCompressed();
- if (messageCompressed) {
- coreMessage.putBooleanProperty(AMQ_MSG_COMPRESSED,
messageCompressed);
- }
-
- switch (coreType) {
- case org.apache.activemq.artemis.api.core.Message.TEXT_TYPE:
- writeTextType(contents, messageCompressed, body);
- break;
- case org.apache.activemq.artemis.api.core.Message.MAP_TYPE:
- writeMapType(contents, messageCompressed, body);
- break;
- case org.apache.activemq.artemis.api.core.Message.OBJECT_TYPE:
- writeObjectType(contents, messageCompressed, body);
- break;
- case org.apache.activemq.artemis.api.core.Message.STREAM_TYPE:
- writeStreamType(contents, messageCompressed, body);
- break;
- case org.apache.activemq.artemis.api.core.Message.BYTES_TYPE:
- writeBytesType(contents, messageCompressed, body);
- break;
- default:
- writeDefaultType(contents, messageCompressed, body);
- break;
- }
+ final ActiveMQBuffer body = openwireMessage.getBodyBuffer();
+ final boolean messageCompressed = messageSend.isCompressed();
+ if (messageCompressed) {
+ openwireMessage.putBooleanProperty(AMQ_MSG_COMPRESSED,
messageCompressed);
}
+ final ByteSequence contents = messageSend.getContent();
+ OpenWireCoreConverter.writeContentIntoBody(body, contents, coreType,
messageCompressed);
//amq specific
- coreMessage.putLongProperty(AMQ_MSG_ARRIVAL,
messageSend.getArrival());
- coreMessage.putLongProperty(AMQ_MSG_BROKER_IN_TIME,
messageSend.getBrokerInTime());
+ openwireMessage.putLongProperty(AMQ_MSG_ARRIVAL,
messageSend.getArrival());
+ openwireMessage.putLongProperty(AMQ_MSG_BROKER_IN_TIME,
messageSend.getBrokerInTime());
final BrokerId[] brokers = messageSend.getBrokerPath();
if (brokers != null) {
- putMsgBrokerPath(brokers, coreMessage);
+ putMsgBrokerPath(brokers, openwireMessage);
}
final BrokerId[] cluster = messageSend.getCluster();
if (cluster != null) {
- putMsgCluster(cluster, coreMessage);
+ putMsgCluster(cluster, openwireMessage);
}
- coreMessage.putIntProperty(AMQ_MSG_COMMAND_ID,
messageSend.getCommandId());
+ openwireMessage.putIntProperty(AMQ_MSG_COMMAND_ID,
messageSend.getCommandId());
final String corrId = messageSend.getCorrelationId();
if (corrId != null) {
- coreMessage.putStringProperty(JMS_CORRELATION_ID_PROPERTY, new
SimpleString(corrId));
+ openwireMessage.putStringProperty(JMS_CORRELATION_ID_PROPERTY,
new SimpleString(corrId));
}
final DataStructure ds = messageSend.getDataStructure();
if (ds != null) {
- putMsgDataStructure(ds, marshaller, coreMessage);
+ putMsgDataStructure(ds, marshaller, openwireMessage);
}
final String groupId = messageSend.getGroupID();
if (groupId != null) {
- coreMessage.putStringProperty(AMQ_MSG_GROUP_ID, new
SimpleString(groupId));
+ openwireMessage.putStringProperty(AMQ_MSG_GROUP_ID, new
SimpleString(groupId));
--- End diff --
this could be pooled with `coreMessageObjectPools` as mentioned above
> [interop] Openwire internal headers should not be part of message properties
> ----------------------------------------------------------------------------
>
> Key: ARTEMIS-1498
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1498
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: OpenWire
> Environment: interoperability between Openwire -> AMQP/Core
> Reporter: Michal Toth
> Priority: Minor
>
> Sending an empty message from Openwire JMS client to AMQP or Core receiver
> client shows extra "internal" headers (__HDR_*) in message properties.
> They should not be there, as these are internal for broker in my opinion.
> Openwire sender
> {noformat}
> $ java -jar /var/dtests/node_data/clients/aoc7.jar sender --timeout 5
> --log-msgs interop --broker tcp://localhost:61616 --address queue_name_\$
> --count 1 --conn-username admin --conn-password admin
> {'durable': True, 'priority': 4, 'ttl': 0, 'first-acquirer': False,
> 'delivery-count': 0, 'id':
> 'dhcp-145-96.lab.eng.brq.redhat.com-33646-1509702974536-1:1:1:1:1',
> 'user-id':None, 'address': 'queue_name_$', 'subject': None, 'reply-to': None,
> 'correlation-id': None, 'content-type': None, 'content-encoding': None,
> 'absolute-expiry-time': 0, 'creation-time': 1509702974798, 'group-id': None,
> 'group-sequence': 0, 'reply-to-group-id': None, 'properties': {}, 'content':
> None, 'type': None}
> {noformat}
> AMQP/Core receiver
> {noformat}
> $ java -jar /var/dtests/node_data/clients/aac1.jar receiver --timeout 5
> --log-msgs interop --broker localhost:5672 --address queue_name_\$ --count 1
> --conn-username admin --conn-password admin
> Unsupported object type org.apache.qpid.proton.amqp.Binary
> \x00\x00\x00Jn\x02\xae\x02{\x00=ID:dhcp-145-96.lab.eng.brq.redhat.com-33646-1509702974536-1:1\x00\x01\x00\x01\x00\x01
> Unsupported object type org.apache.qpid.proton.amqp.Binary
> \x00\x00\x00F{\x01+\x00=ID:dhcp-145-96.lab.eng.brq.redhat.com-33646-1509702974536-1:1\x00\x01\x00\x01
> {'durable': True, 'priority': 4, 'ttl': 0, 'first-acquirer': False,
> 'delivery-count': 0, 'id': None, 'user-id': None, 'address': 'queue_name_$',
> 'subject': None, 'reply-to': None, 'correlation-id': None, 'content-type':
> None, 'content-encoding': None, 'absolute-expiry-time': 0, 'creation-time':
> 1509702974798, 'group-id': None, 'group-sequence': 0, 'reply-to-group-id':
> None, 'properties': {'__HDR_COMMAND_ID': 5, 'JMSXDeliveryCount': 1,
> '__HDR_ARRIVAL': 0, '__HDR_MESSAGE_ID':
> \x00\x00\x00Jn\x02\xae\x02{\x00=ID:dhcp-145-96.lab.eng.brq.redhat.com-33646-1509702974536-1:1\x00\x01\x00\x01\x00\x01,
> '__HDR_GROUP_SEQUENCE': 0, '__HDR_PRODUCER_ID':
> \x00\x00\x00F{\x01+\x00=ID:dhcp-145-96.lab.eng.brq.redhat.com-33646-1509702974536-1:1\x00\x01\x00\x01,
> '__HDR_DROPPABLE': False, '__HDR_BROKER_IN_TIME': 1509702974800}, 'content':
> None}
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)