Search in sources :

Example 1 with BrokerId

use of org.apache.activemq.command.BrokerId in project activemq-artemis by apache.

the class OpenWireMessageConverter method setAMQMsgBrokerPath.

private static void setAMQMsgBrokerPath(final ActiveMQMessage amqMsg, final String brokerPath) {
    String[] brokers = brokerPath.split(",");
    BrokerId[] bids = new BrokerId[brokers.length];
    for (int i = 0; i < bids.length; i++) {
        bids[i] = new BrokerId(brokers[i]);
    }
    amqMsg.setBrokerPath(bids);
}
Also used : BrokerId(org.apache.activemq.command.BrokerId) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Example 2 with BrokerId

use of org.apache.activemq.command.BrokerId in project activemq-artemis by apache.

the class OpenWireMessageConverter method inbound.

public static org.apache.activemq.artemis.api.core.Message inbound(final Message messageSend, final WireFormat marshaller, final CoreMessageObjectPools coreMessageObjectPools) throws Exception {
    final CoreMessage coreMessage = new CoreMessage(-1, messageSend.getSize(), coreMessageObjectPools);
    final String type = messageSend.getType();
    if (type != null) {
        coreMessage.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);
    final ActiveMQBuffer body = coreMessage.getBodyBuffer();
    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;
        }
    }
    // amq specific
    coreMessage.putLongProperty(AMQ_MSG_ARRIVAL, messageSend.getArrival());
    coreMessage.putLongProperty(AMQ_MSG_BROKER_IN_TIME, messageSend.getBrokerInTime());
    final BrokerId[] brokers = messageSend.getBrokerPath();
    if (brokers != null) {
        putMsgBrokerPath(brokers, coreMessage);
    }
    final BrokerId[] cluster = messageSend.getCluster();
    if (cluster != null) {
        putMsgCluster(cluster, coreMessage);
    }
    coreMessage.putIntProperty(AMQ_MSG_COMMAND_ID, messageSend.getCommandId());
    final String corrId = messageSend.getCorrelationId();
    if (corrId != null) {
        coreMessage.putStringProperty(JMS_CORRELATION_ID_PROPERTY, new SimpleString(corrId));
    }
    final DataStructure ds = messageSend.getDataStructure();
    if (ds != null) {
        putMsgDataStructure(ds, marshaller, coreMessage);
    }
    final String groupId = messageSend.getGroupID();
    if (groupId != null) {
        coreMessage.putStringProperty(AMQ_MSG_GROUP_ID, coreMessageObjectPools.getGroupIdStringSimpleStringPool().getOrCreate(groupId));
    }
    coreMessage.putIntProperty(AMQ_MSG_GROUP_SEQUENCE, messageSend.getGroupSequence());
    final MessageId messageId = messageSend.getMessageId();
    final ByteSequence midBytes = marshaller.marshal(messageId);
    midBytes.compact();
    coreMessage.putBytesProperty(AMQ_MSG_MESSAGE_ID, midBytes.data);
    final ProducerId producerId = messageSend.getProducerId();
    if (producerId != null) {
        final ByteSequence producerIdBytes = marshaller.marshal(producerId);
        producerIdBytes.compact();
        coreMessage.putBytesProperty(AMQ_MSG_PRODUCER_ID, producerIdBytes.data);
    }
    final ByteSequence propBytes = messageSend.getMarshalledProperties();
    if (propBytes != null) {
        putMsgMarshalledProperties(propBytes, messageSend, coreMessage);
    }
    final ActiveMQDestination replyTo = messageSend.getReplyTo();
    if (replyTo != null) {
        putMsgReplyTo(replyTo, marshaller, coreMessage);
    }
    final String userId = messageSend.getUserID();
    if (userId != null) {
        coreMessage.putStringProperty(AMQ_MSG_USER_ID, new SimpleString(userId));
    }
    coreMessage.putBooleanProperty(AMQ_MSG_DROPPABLE, messageSend.isDroppable());
    final ActiveMQDestination origDest = messageSend.getOriginalDestination();
    if (origDest != null) {
        putMsgOriginalDestination(origDest, marshaller, coreMessage);
    }
    return coreMessage;
}
Also used : BrokerId(org.apache.activemq.command.BrokerId) ProducerId(org.apache.activemq.command.ProducerId) DataStructure(org.apache.activemq.command.DataStructure) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ByteSequence(org.apache.activemq.util.ByteSequence) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) MessageId(org.apache.activemq.command.MessageId) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Example 3 with BrokerId

use of org.apache.activemq.command.BrokerId in project activemq-artemis by apache.

the class BrokerIdTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    BrokerId info = (BrokerId) object;
    info.setValue("Value:1");
}
Also used : BrokerId(org.apache.activemq.command.BrokerId)

Example 4 with BrokerId

use of org.apache.activemq.command.BrokerId in project activemq-artemis by apache.

the class BrokerIdTest method createObject.

@Override
public Object createObject() throws Exception {
    BrokerId info = new BrokerId();
    populateObject(info);
    return info;
}
Also used : BrokerId(org.apache.activemq.command.BrokerId)

Example 5 with BrokerId

use of org.apache.activemq.command.BrokerId in project activemq-artemis by apache.

the class BrokerIdTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    BrokerId info = (BrokerId) object;
    info.setValue("Value:1");
}
Also used : BrokerId(org.apache.activemq.command.BrokerId)

Aggregations

BrokerId (org.apache.activemq.command.BrokerId)24 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 BrokerInfo (org.apache.activemq.command.BrokerInfo)3 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)1 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)1 BrokerService (org.apache.activemq.broker.BrokerService)1 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)1 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)1 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)1 ConnectionId (org.apache.activemq.command.ConnectionId)1 ConsumerId (org.apache.activemq.command.ConsumerId)1 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)1 DataStructure (org.apache.activemq.command.DataStructure)1 MessageDispatch (org.apache.activemq.command.MessageDispatch)1 MessageId (org.apache.activemq.command.MessageId)1 ProducerId (org.apache.activemq.command.ProducerId)1 RemoveInfo (org.apache.activemq.command.RemoveInfo)1 SessionId (org.apache.activemq.command.SessionId)1 Transport (org.apache.activemq.transport.Transport)1