From dev-return-63892-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Thu Feb 1 12:35:55 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8ED9B180652 for ; Thu, 1 Feb 2018 12:35:55 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7E9CA160C44; Thu, 1 Feb 2018 11:35:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C728E160C26 for ; Thu, 1 Feb 2018 12:35:54 +0100 (CET) Received: (qmail 99633 invoked by uid 500); 1 Feb 2018 11:35:53 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 99621 invoked by uid 99); 1 Feb 2018 11:35:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2018 11:35:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 04800DFB31; Thu, 1 Feb 2018 11:35:53 +0000 (UTC) From: franz1981 To: dev@activemq.apache.org Reply-To: dev@activemq.apache.org References: In-Reply-To: Subject: [GitHub] activemq-artemis pull request #1793: ARTEMIS-1498: Openwire internal headers... Content-Type: text/plain Message-Id: <20180201113553.04800DFB31@git1-us-west.apache.org> Date: Thu, 1 Feb 2018 11:35:53 +0000 (UTC) Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1793#discussion_r165331112 --- Diff: artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireCoreConverter.java --- @@ -0,0 +1,572 @@ +/* + * 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.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.zip.Deflater; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.Inflater; +import java.util.zip.InflaterInputStream; +import java.util.zip.InflaterOutputStream; + +import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.FilterConstants; +import org.apache.activemq.artemis.api.core.ICoreMessage; +import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.core.message.impl.CoreMessage; +import org.apache.activemq.artemis.core.message.impl.CoreMessageObjectPools; +import org.apache.activemq.artemis.reader.MessageUtil; +import org.apache.activemq.artemis.utils.DataConstants; +import org.apache.activemq.artemis.utils.collections.TypedProperties; +import org.apache.activemq.command.CommandTypes; +import org.apache.activemq.util.ByteArrayInputStream; +import org.apache.activemq.util.ByteSequence; +import org.apache.activemq.util.ByteSequenceData; +import org.apache.activemq.util.MarshallingSupport; +import org.fusesource.hawtbuf.UTF8Buffer; + +public class OpenWireCoreConverter { + public static final SimpleString JMS_GROUPSEQ = new SimpleString("JMSXGroupSequence"); + public static final SimpleString JMS_XGROUPSEQ = new SimpleString("JMSXGroupSeq"); + public static final SimpleString JMS_GROUPID = new SimpleString("JMSXGroupID"); + private static final SimpleString AMQP_REPLYTOGROUPID = new SimpleString("JMS_AMQP_ReplyToGroupID"); + public static final SimpleString JMS_CONTENT_TYPE = new SimpleString("JMS_AMQP_ContentType"); + private static final SimpleString AMQP_CONTETTYPE = new SimpleString("JMS_AMQP_CONTENT_TYPE"); + + public static ICoreMessage toCore(final OpenWireMessage openwireMessage, final CoreMessageObjectPools coreMessageObjectPools) + throws Exception { + CoreMessage coreMessage = new CoreMessage(-1, openwireMessage.getMessageSize(), coreMessageObjectPools); + final SimpleString type = openwireMessage.getSimpleStringProperty(new SimpleString("JMSType")); + if (type != null) { + coreMessage.putStringProperty(SimpleString.toSimpleString("JMSType"), type); --- End diff -- Cache `SimpleString.toSimpleString("JMSType")` to avoid allocations ---