if (jmsType != null) { try { jmsMessage.setJMSType(jmsType);
message.setJMSCorrelationID(entry.getValue()); } else if (entry.getKey().equals(JmsHeaders.TYPE)) { message.setJMSType(entry.getValue()); } else if (entry.getKey().equals(JmsHeaders.REPLY_TO)) { Destination destination = buildDestination(entry.getValue());
@Test public void jmsTypeMappedToHeader() throws JMSException { String type = "testing"; javax.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSType(type); assertInboundHeader(jmsMessage, JmsHeaders.TYPE, type); }
message.setJMSType(jmsHeaderType);
/** * Copies the standard JMS and user defined properties from the givem * message to the specified message * * @param fromMessage the message to take the properties from * @param toMessage the message to add the properties to * @throws JMSException */ public static void copyProperties(Message fromMessage, Message toMessage) throws JMSException { toMessage.setJMSMessageID(fromMessage.getJMSMessageID()); toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID()); toMessage.setJMSReplyTo(transformDestination(fromMessage.getJMSReplyTo())); toMessage.setJMSDestination(transformDestination(fromMessage.getJMSDestination())); toMessage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode()); toMessage.setJMSRedelivered(fromMessage.getJMSRedelivered()); toMessage.setJMSType(fromMessage.getJMSType()); toMessage.setJMSExpiration(fromMessage.getJMSExpiration()); toMessage.setJMSPriority(fromMessage.getJMSPriority()); toMessage.setJMSTimestamp(fromMessage.getJMSTimestamp()); Enumeration propertyNames = fromMessage.getPropertyNames(); while (propertyNames.hasMoreElements()) { String name = propertyNames.nextElement().toString(); Object obj = fromMessage.getObjectProperty(name); toMessage.setObjectProperty(name, obj); } } }
if (jmsType instanceof String) { try { jmsMessage.setJMSType((String) jmsType);
@Test public void testJmsTypeMappedToHeader() throws JMSException { String type = "testing"; javax.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSType(type); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map<String, Object> headers = mapper.toHeaders(jmsMessage); Object attrib = headers.get(JmsHeaders.TYPE); assertNotNull(attrib); assertSame(type, attrib); }
public void setJMSType(String type) throws JMSException { message.setJMSType(type); }
@Override public void setJMSType(final String type) throws JMSException { message.setJMSType(type); }
public void setJMSType(String type) throws JMSException { message.setJMSType(type); }
/** * Set type * @param type The value * @exception JMSException Thrown if an error occurs */ public void setJMSType(final String type) throws JMSException { if (_log.isTraceEnabled()) { _log.trace("setJMSType(" + type + ")"); } _message.setJMSType(type); }
private void setProperty(String property, Object value, Message message) throws JMSException { if(property == null) return; if(property.equals(JMSConstants.JMS_CORRELATION_ID)) message.setJMSCorrelationID((String)value); else if(property.equals(JMSConstants.JMS_CORRELATION_ID_AS_BYTES)) message.setJMSCorrelationIDAsBytes((byte[])value); else if(property.equals(JMSConstants.JMS_TYPE)) message.setJMSType((String)value); else message.setObjectProperty(property, value); } }
private void setProperty(String property, Object value, Message message) throws JMSException { if(property == null) return; if(property.equals(JMSConstants.JMS_CORRELATION_ID)) message.setJMSCorrelationID((String)value); else if(property.equals(JMSConstants.JMS_CORRELATION_ID_AS_BYTES)) message.setJMSCorrelationIDAsBytes((byte[])value); else if(property.equals(JMSConstants.JMS_TYPE)) message.setJMSType((String)value); else message.setObjectProperty(property, value); } }
/** * Set type * * @param type The value * @throws JMSException Thrown if an error occurs */ @Override public void setJMSType(final String type) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setJMSType(" + type + ")"); } message.setJMSType(type); }
private void setProperty(String property, Object value, Message message) throws JMSException { if(property == null) return; if(property.equals(JMSConstants.JMS_CORRELATION_ID)) message.setJMSCorrelationID((String)value); else if(property.equals(JMSConstants.JMS_CORRELATION_ID_AS_BYTES)) message.setJMSCorrelationIDAsBytes((byte[])value); else if(property.equals(JMSConstants.JMS_TYPE)) message.setJMSType((String)value); else message.setObjectProperty(property, value); } }
/** * Set type * * @param type The value * @throws JMSException Thrown if an error occurs */ @Override public void setJMSType(final String type) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setJMSType(" + type + ")"); } message.setJMSType(type); }
protected void copyStandardHeadersFromFrameToMessage(StompFrame command, Message msg) throws JMSException, ProtocolException { final Map headers = new HashMap(command.getHeaders()); // the standard JMS headers msg.setJMSCorrelationID((String) headers.remove(Stomp.Headers.Send.CORRELATION_ID)); Object o = headers.remove(Stomp.Headers.Send.TYPE); if (o != null) { msg.setJMSType((String) o); } o = headers.remove(Stomp.Headers.Send.REPLY_TO); if (o != null) { msg.setJMSReplyTo(convertDestination((String) o)); } // now the general headers for (Iterator iter = headers.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); msg.setObjectProperty(name, value); } }
@Override public void execute(Context context, CallableUnitCallback callableUnitCallback) { Struct messageStruct = BallerinaAdapter.getReceiverObject(context); Message message = BallerinaAdapter.getNativeObject(messageStruct, Constants.JMS_MESSAGE_OBJECT, Message.class, context); String type = context.getStringArgument(0); try { message.setJMSType(type); } catch (JMSException e) { BallerinaAdapter.returnError("Error when setting float property", context, e); } } }
@Test public void testJMSType() throws Exception { Message m = queueProducerSession.createMessage(); String originalType = "TYPE1"; m.setJMSType(originalType); queueProducer.send(m); String gotType = queueConsumer.receive(1000).getJMSType(); ProxyAssertSupport.assertEquals(originalType, gotType); }
protected void prepareMessage(final Message m) throws JMSException { m.setBooleanProperty("booleanProperty", true); m.setByteProperty("byteProperty", (byte) 3); m.setDoubleProperty("doubleProperty", 4.0); m.setFloatProperty("floatProperty", 5.0f); m.setIntProperty("intProperty", 6); m.setLongProperty("longProperty", 7); m.setShortProperty("shortProperty", (short) 8); m.setStringProperty("stringProperty", "this is a String property"); m.setJMSCorrelationID("this is the correlation ID"); m.setJMSReplyTo(ActiveMQServerTestCase.topic1); m.setJMSType("someArbitraryType"); }