本文整理了Java中javax.jms.Message.setJMSReplyTo()
方法的一些代码示例,展示了Message.setJMSReplyTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setJMSReplyTo()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:setJMSReplyTo
[英]Sets the Destination object to which a reply to this message should be sent.
The JMSReplyTo header field contains the destination where a reply to the current message should be sent. If it is null, no reply is expected. The destination may be either a Queue object or a Topic object.
Messages sent with a null JMSReplyTo value may be a notification of some event, or they may just be some data the sender thinks is of interest.
Messages with a JMSReplyTo value typically expect a response. A response is optional; it is up to the client to decide. These messages are called requests. A message sent in response to a request is called a reply.
In some cases a client may wish to match a request it sent earlier with a reply it has just received. The client can use the JMSCorrelationID header field for this purpose.
[中]设置应向其发送对此消息的答复的目标对象。
JMSReplyTo标头字段包含应在其中发送对当前消息的答复的目的地。如果为空,则不需要回复。目标可以是队列对象或主题对象。
使用null JMSReplyTo值发送的消息可能是某个事件的通知,也可能只是发送者认为感兴趣的某个数据。
具有JMSReplyTo值的消息通常需要响应。响应是可选的;由客户决定。这些消息称为请求。响应请求而发送的消息称为回复。
在某些情况下,客户机可能希望将其先前发送的请求与刚刚收到的答复相匹配。客户机可以使用JMSCOrrationId头字段来实现此目的。
代码示例来源:origin: apache/activemq
/**
* Convert a foreign JMS Message to a native ActiveMQ Message - Inbound or
* visa-versa outbound. If the replyTo Destination instance is not null
* then the Message is configured with the given replyTo value.
*
* @param message
* The target message to convert to a native ActiveMQ message
* @param replyTo
* The replyTo Destination to set on the converted Message.
*
* @return the converted message
* @throws JMSException
*/
public Message convert(Message message, Destination replyTo) throws JMSException {
Message msg = convert(message);
if (replyTo != null) {
msg.setJMSReplyTo(replyTo);
} else {
msg.setJMSReplyTo(null);
}
return msg;
}
代码示例来源:origin: spring-projects/spring-framework
producer = session.createProducer(queue);
consumer = session.createConsumer(responseQueue);
requestMessage.setJMSReplyTo(responseQueue);
producer.send(requestMessage);
long timeout = getReceiveTimeout();
代码示例来源:origin: spring-projects/spring-framework
if (jmsReplyTo != null) {
try {
jmsMessage.setJMSReplyTo(jmsReplyTo);
代码示例来源:origin: spring-projects/spring-framework
producer = session.createProducer(destination);
consumer = session.createConsumer(responseQueue);
requestMessage.setJMSReplyTo(responseQueue);
if (logger.isDebugEnabled()) {
logger.debug("Sending created message: " + requestMessage);
代码示例来源:origin: wildfly/wildfly
/** Sends a request and waits for a reply. The temporary queue is used for
* the {@code JMSReplyTo} destination, and only one reply per request
* is expected.
*
* @param message the message to send
*
* @return the reply message
*
* @exception JMSException if the JMS provider fails to complete the
* request due to some internal error.
*/
public Message
request(Message message) throws JMSException {
message.setJMSReplyTo(tempQueue);
sender.send(message);
return (receiver.receive());
}
代码示例来源:origin: wildfly/wildfly
/** Sends a request and waits for a reply. The temporary topic is used for
* the {@code JMSReplyTo} destination; the first reply is returned,
* and any following replies are discarded.
*
* @param message the message to send
*
* @return the reply message
*
* @exception JMSException if the JMS provider fails to complete the
* request due to some internal error.
*/
public Message
request(Message message) throws JMSException {
message.setJMSReplyTo(tempTopic);
publisher.publish(message);
return(subscriber.receive());
}
代码示例来源:origin: apache/nifi
Destination destination = buildDestination(entry.getValue());
if (destination != null) {
message.setJMSReplyTo(destination);
} else {
logUnbuildableDestination(entry.getKey(), JmsHeaders.REPLY_TO);
代码示例来源:origin: spring-projects/spring-framework
@Test
public void jmsReplyToMappedToHeader() throws JMSException {
Destination replyTo = new Destination() {};
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSReplyTo(replyTo);
assertInboundHeader(jmsMessage, JmsHeaders.REPLY_TO, replyTo);
}
代码示例来源:origin: wildfly/wildfly
message.setJMSReplyTo(jmsHeaderReplyTo);
代码示例来源:origin: apache/nifi
message.setJMSReplyTo(replyToQueue);
代码示例来源:origin: apache/activemq
message.setJMSReplyTo(null);
converted = jmsMessageConvertor.convert(message);
代码示例来源:origin: apache/activemq
/**
* 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);
}
}
}
代码示例来源:origin: spring-projects/spring-integration
if (jmsReplyTo instanceof Destination) {
try {
jmsMessage.setJMSReplyTo((Destination) jmsReplyTo);
代码示例来源:origin: org.apache.geronimo.specs/geronimo-jms_1.1_spec
public Message request(Message message) throws JMSException {
message.setJMSReplyTo(getTemporaryQueue());
getSender().send(message);
return getReceiver().receive();
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-jms_1.1_spec
public Message request(Message message) throws JMSException {
message.setJMSReplyTo(getTemporaryTopic());
getPublisher().publish(message);
return (getSubscriber().receive());
}
代码示例来源:origin: spring-projects/spring-integration
jmsRequest.setJMSReplyTo(replyTo);
connection.start();
if (logger.isDebugEnabled()) {
代码示例来源:origin: spring-projects/spring-integration
jmsRequest.setJMSReplyTo(replyTo);
connection.start();
if (logger.isDebugEnabled()) {
代码示例来源:origin: spring-projects/spring-integration
@Test
public void testJmsReplyToMappedToHeader() throws JMSException {
Destination replyTo = new Destination() {
};
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSReplyTo(replyTo);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.toHeaders(jmsMessage);
Object attrib = headers.get(JmsHeaders.REPLY_TO);
assertNotNull(attrib);
assertSame(replyTo, attrib);
}
代码示例来源:origin: org.apache.openejb/javaee-api
public Message request(Message message) throws JMSException {
message.setJMSReplyTo(getTemporaryTopic());
getPublisher().publish(message);
return (getSubscriber().receive());
}
代码示例来源:origin: apache/cxf
private void postGetMessage(Session session, Destination destination, Destination replyTo)
throws Exception {
MessageProducer producer = session.createProducer(destination);
Message message = session.createBytesMessage();
message.setJMSReplyTo(replyTo);
message.setStringProperty("Accept", "application/xml");
message.setStringProperty(org.apache.cxf.message.Message.REQUEST_URI, "/bookstore/books/123");
message.setStringProperty(org.apache.cxf.message.Message.HTTP_REQUEST_METHOD, "GET");
producer.send(message);
producer.close();
}
内容来源于网络,如有侵权,请联系作者删除!