ARTEMIS-536 Fix AMQP List/Sequence decoding
This commit is contained in:
parent
ecd9c13625
commit
d4038ec59a
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.activemq.artemis.core.protocol.proton.converter.message;
|
||||||
|
|
||||||
|
public class AMQPMessageTypes {
|
||||||
|
public static final String AMQP_TYPE_KEY = "amqp:type";
|
||||||
|
|
||||||
|
public static final String AMQP_SEQUENCE = "amqp:sequence";
|
||||||
|
|
||||||
|
public static final String AMQP_LIST = "amqp:list";
|
||||||
|
}
|
|
@ -72,6 +72,7 @@ public class JMSMappingInboundTransformer extends InboundTransformer {
|
||||||
m.writeObject(item);
|
m.writeObject(item);
|
||||||
}
|
}
|
||||||
rc = m;
|
rc = m;
|
||||||
|
m.setStringProperty(AMQPMessageTypes.AMQP_TYPE_KEY, AMQPMessageTypes.AMQP_SEQUENCE);
|
||||||
}
|
}
|
||||||
else if (body instanceof AmqpValue) {
|
else if (body instanceof AmqpValue) {
|
||||||
Object value = ((AmqpValue) body).getValue();
|
Object value = ((AmqpValue) body).getValue();
|
||||||
|
@ -95,6 +96,7 @@ public class JMSMappingInboundTransformer extends InboundTransformer {
|
||||||
m.writeObject(item);
|
m.writeObject(item);
|
||||||
}
|
}
|
||||||
rc = m;
|
rc = m;
|
||||||
|
m.setStringProperty(AMQPMessageTypes.AMQP_TYPE_KEY, AMQPMessageTypes.AMQP_LIST);
|
||||||
}
|
}
|
||||||
else if (value instanceof Map) {
|
else if (value instanceof Map) {
|
||||||
MapMessage m = vendor.createMapMessage();
|
MapMessage m = vendor.createMapMessage();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.artemis.core.protocol.proton.converter.message;
|
package org.apache.activemq.artemis.core.protocol.proton.converter.message;
|
||||||
|
|
||||||
|
import org.apache.activemq.artemis.jms.client.ActiveMQMessage;
|
||||||
import org.apache.qpid.proton.amqp.Binary;
|
import org.apache.qpid.proton.amqp.Binary;
|
||||||
import org.apache.qpid.proton.amqp.Symbol;
|
import org.apache.qpid.proton.amqp.Symbol;
|
||||||
import org.apache.qpid.proton.amqp.UnsignedByte;
|
import org.apache.qpid.proton.amqp.UnsignedByte;
|
||||||
|
@ -126,7 +127,14 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
|
||||||
}
|
}
|
||||||
catch (MessageEOFException e) {
|
catch (MessageEOFException e) {
|
||||||
}
|
}
|
||||||
body = new AmqpSequence(list);
|
|
||||||
|
String amqpType = msg.getStringProperty(AMQPMessageTypes.AMQP_TYPE_KEY);
|
||||||
|
if (amqpType.equals(AMQPMessageTypes.AMQP_LIST)) {
|
||||||
|
body = new AmqpValue(list);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
body = new AmqpSequence(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (msg instanceof ObjectMessage) {
|
if (msg instanceof ObjectMessage) {
|
||||||
body = new AmqpValue(((ObjectMessage) msg).getObject());
|
body = new AmqpValue(((ObjectMessage) msg).getObject());
|
||||||
|
@ -256,6 +264,9 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
|
||||||
String name = key.substring(prefixFooterKey.length());
|
String name = key.substring(prefixFooterKey.length());
|
||||||
footerMap.put(name, msg.getObjectProperty(key));
|
footerMap.put(name, msg.getObjectProperty(key));
|
||||||
}
|
}
|
||||||
|
else if (key.equals(AMQPMessageTypes.AMQP_TYPE_KEY)) {
|
||||||
|
// skip
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (apMap == null) {
|
if (apMap == null) {
|
||||||
apMap = new HashMap();
|
apMap = new HashMap();
|
||||||
|
|
Loading…
Reference in New Issue