private boolean handleCoreProperty(final String name, final Object value, String jmsPropertyName, SimpleString corePropertyName) { boolean result = false; if (jmsPropertyName.equals(name)) { message.putStringProperty(corePropertyName, value == null ? null : value.toString()); result = true; } return result; }
/** * Sends a message to the request address and wait for the given timeout for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @param timeout the timeout to wait for a reply (in milliseconds) * @return the reply message or {@code null} if no message is replied before the timeout elapses * @throws Exception */ public ClientMessage request(final ClientMessage request, final long timeout) throws Exception { request.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, replyQueue); requestProducer.send(request); return replyConsumer.receive(timeout); }
@Override public void setStringProperty(final String name, final String value) throws JMSException { checkProperty(name); if (handleCoreProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) { return; } else if (handleCoreProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) { return; } else { message.putStringProperty(name, value); } }
coreMessage.putStringProperty(ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME, connID);
private boolean handleCoreProperty(final String name, final Object value, String jmsPropertyName, SimpleString corePropertyName) { boolean result = false; if (jmsPropertyName.equals(name)) { message.putStringProperty(corePropertyName, value == null ? null : value.toString()); result = true; } return result; }
private boolean handleCoreProperty(final String name, final Object value, String jmsPropertyName, SimpleString corePropertyName) { boolean result = false; if (jmsPropertyName.equals(name)) { message.putStringProperty(corePropertyName, value == null ? null : value.toString()); result = true; } return result; }
public static void setHttpHeader(ClientMessage message, String name, String value) { message.putStringProperty(HttpHeaderProperty.toPropertyName(name), value); }
public static void setHttpHeader(ClientMessage message, String name, String value) { message.putStringProperty(HttpHeaderProperty.toPropertyName(name), value); }
/** * Sends a message to the request address and wait for the given timeout for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @param timeout the timeout to wait for a reply (in milliseconds) * @return the reply message or {@code null} if no message is replied before the timeout elapses * @throws Exception */ public ClientMessage request(final ClientMessage request, final long timeout) throws Exception { request.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, replyQueue); requestProducer.send(request); return replyConsumer.receive(timeout); }
/** * Sends a message to the request address and wait for the given timeout for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @param timeout the timeout to wait for a reply (in milliseconds) * @return the reply message or {@code null} if no message is replied before the timeout elapses * @throws Exception */ public ClientMessage request(final ClientMessage request, final long timeout) throws Exception { request.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, replyQueue); requestProducer.send(request); return replyConsumer.receive(timeout); }
/** * Sends a message to the request address and wait for the given timeout for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @param timeout the timeout to wait for a reply (in milliseconds) * @return the reply message or {@code null} if no message is replied before the timeout elapses * @throws Exception */ public ClientMessage request(final ClientMessage request, final long timeout) throws Exception { request.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, replyQueue); requestProducer.send(request); return replyConsumer.receive(timeout); }
@Override public void setStringProperty(final String name, final String value) throws JMSException { checkProperty(name); if (handleCoreProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) { return; } else if (handleCoreProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) { return; } else { message.putStringProperty(name, value); } }
@Override public void setStringProperty(final String name, final String value) throws JMSException { checkProperty(name); if (handleCoreProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) { return; } else if (handleCoreProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) { return; } else { message.putStringProperty(name, value); } }
public static void writeHttpMessage(HttpHeaders headers, byte[] body, ClientMessage message) throws Exception { MultivaluedMap<String, String> hdrs = headers.getRequestHeaders(); for (Entry<String, List<String>> entry : hdrs.entrySet()) { String key = entry.getKey(); if (isTransferableHttpHeader(key)) { List<String> vals = entry.getValue(); String value = concatenateHeaderValue(vals); message.putStringProperty(HttpHeaderProperty.toPropertyName(key), value); } } message.putBooleanProperty(POSTED_AS_HTTP_MESSAGE, true); message.getBodyBuffer().writeBytes(body); }
public static void writeHttpMessage(HttpHeaders headers, byte[] body, ClientMessage message) throws Exception { MultivaluedMap<String, String> hdrs = headers.getRequestHeaders(); for (Entry<String, List<String>> entry : hdrs.entrySet()) { String key = entry.getKey(); if (isTransferableHttpHeader(key)) { List<String> vals = entry.getValue(); String value = concatenateHeaderValue(vals); message.putStringProperty(HttpHeaderProperty.toPropertyName(key), value); } } message.putBooleanProperty(POSTED_AS_HTTP_MESSAGE, true); message.getBodyBuffer().writeBytes(body); }
/** * @param session * @param producer * @throws Exception */ private void sendMessage(ClientSession session, ClientProducer producer, String color, String msg) throws Exception { ClientMessage anyMessage = session.createMessage(true); anyMessage.putStringProperty("color", color); anyMessage.putStringProperty("value", msg); producer.send(anyMessage); session.commit(); } }
@Override public boolean intercept(final Packet packet, final RemotingConnection connection) throws ActiveMQException { if (packet.getType() == PacketImpl.SESS_SEND) { SessionSendMessage p = (SessionSendMessage) packet; ClientMessage cm = (ClientMessage) p.getMessage(); cm.putStringProperty(InterceptorTest.key, "orange"); } return true; }
@Override public boolean intercept(final Packet packet, final RemotingConnection connection) throws ActiveMQException { if (packet.getType() == PacketImpl.SESS_RECEIVE_MSG) { SessionReceiveMessage p = (SessionReceiveMessage) packet; ClientMessage cm = (ClientMessage) p.getMessage(); cm.putStringProperty(InterceptorTest.key, "orange"); } return true; }
protected void setProperty(Message message) { ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, new SimpleString("foo")); }
protected void setProperty(Message message) { if (coreSend) { ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, new SimpleString("foo")); } else { org.apache.activemq.command.ActiveMQMessage m = (org.apache.activemq.command.ActiveMQMessage) message; m.setGroupID("foo"); } } }