[
https://issues.apache.org/jira/browse/ARTEMIS-2682?focusedWorklogId=421882&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-421882
]
ASF GitHub Bot logged work on ARTEMIS-2682:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 14/Apr/20 07:12
Start Date: 14/Apr/20 07:12
Worklog Time Spent: 10m
Work Description: fvaleri commented on pull request #3043: ARTEMIS-2682:
OpenWireMessageConverter refactoring
URL: https://github.com/apache/activemq-artemis/pull/3043#discussion_r407913973
##########
File path:
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageSupport.java
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.openwire;
+
+import java.io.IOException;
+
+import org.apache.activemq.artemis.api.core.ICoreMessage;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.wireformat.WireFormat;
+
+public class OpenWireMessageSupport {
+
+ public static final SimpleString JMS_TYPE_PROPERTY = new
SimpleString("JMSType");
+ public static final SimpleString JMS_CORRELATION_ID_PROPERTY = new
SimpleString("JMSCorrelationID");
+ public static final SimpleString AMQ_PREFIX = new SimpleString("__HDR_");
+
+ public static final SimpleString
AMQ_MSG_DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = new SimpleString(AMQ_PREFIX +
"dlqDeliveryFailureCause");
+ public static final SimpleString AMQ_MSG_ARRIVAL = new
SimpleString(AMQ_PREFIX + "ARRIVAL");
+ public static final SimpleString AMQ_MSG_BROKER_IN_TIME = new
SimpleString(AMQ_PREFIX + "BROKER_IN_TIME");
+ public static final SimpleString AMQ_MSG_BROKER_PATH = new
SimpleString(AMQ_PREFIX + "BROKER_PATH");
+ public static final SimpleString AMQ_MSG_CLUSTER = new
SimpleString(AMQ_PREFIX + "CLUSTER");
+ public static final SimpleString AMQ_MSG_COMMAND_ID = new
SimpleString(AMQ_PREFIX + "COMMAND_ID");
+ public static final SimpleString AMQ_MSG_DATASTRUCTURE = new
SimpleString(AMQ_PREFIX + "DATASTRUCTURE");
+ public static final SimpleString AMQ_MSG_MESSAGE_ID = new
SimpleString(AMQ_PREFIX + "MESSAGE_ID");
+ public static final SimpleString AMQ_MSG_ORIG_DESTINATION = new
SimpleString(AMQ_PREFIX + "ORIG_DESTINATION");
+ public static final SimpleString AMQ_MSG_ORIG_TXID = new
SimpleString(AMQ_PREFIX + "ORIG_TXID");
+ public static final SimpleString AMQ_MSG_PRODUCER_ID = new
SimpleString(AMQ_PREFIX + "PRODUCER_ID");
+ public static final SimpleString AMQ_MSG_MARSHALL_PROP = new
SimpleString(AMQ_PREFIX + "MARSHALL_PROP");
+ public static final SimpleString AMQ_MSG_REPLY_TO = new
SimpleString(AMQ_PREFIX + "REPLY_TO");
+ public static final SimpleString AMQ_MSG_USER_ID = new
SimpleString(AMQ_PREFIX + "USER_ID");
+ public static final SimpleString AMQ_MSG_DROPPABLE = new
SimpleString(AMQ_PREFIX + "DROPPABLE");
+ public static final SimpleString AMQ_MSG_COMPRESSED = new
SimpleString(AMQ_PREFIX + "COMPRESSED");
+
+ public static Object getBinObjectProperty(WireFormat format,
+ ICoreMessage coreMessage,
+ SimpleString propertyKey) throws
IOException {
+ if (format == null || coreMessage == null || isNullOrEmpty(propertyKey))
{
+ return null;
+ }
+ Object object = coreMessage.getObjectProperty(propertyKey);
+ if (object == null || !(object instanceof byte[])) {
+ return null;
+ }
+ ByteSequence seq = new ByteSequence((byte[]) object);
+ return format.unmarshal(seq);
+ }
+
+ public static void setBinObjectProperty(WireFormat format,
Review comment:
Sure
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 421882)
Time Spent: 3h 10m (was: 3h)
> OpenWireMessageConverter refactoring
> ------------------------------------
>
> Key: ARTEMIS-2682
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2682
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: OpenWire
> Affects Versions: 2.12.0
> Reporter: Federico Valeri
> Priority: Minor
> Labels: openwire, refactoring
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> I'm proposing theĀ {{OpenWireMessageConverter}} refactoring to have a similar
> layout as the {{AMQPConverter}}. The latter has two dedicated classes for
> inbound and outbound messages with a singleton entry point for the converter.
> This change is basically doing the same without semantics change and also
> adding a unit test for the converter. I'm also eliminating some duplicated
> code, but the bulk of the code remains untouched.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)