本文整理汇总了Java中javax.jms.Message.getJMSReplyTo方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getJMSReplyTo方法的具体用法?Java Message.getJMSReplyTo怎么用?Java Message.getJMSReplyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jms.Message
的用法示例。
在下文中一共展示了Message.getJMSReplyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidRequestResponse
import javax.jms.Message; //导入方法依赖的package包/类
/**
* Since we use a request/response communication style with the client,
* we must ensure that tha appropriate fields are set.
*/
private boolean isValidRequestResponse(Message incoming) {
try {
if (incoming.getJMSCorrelationID() == null) {
getLogger().warn("JMSCorrelationID is not set! Will not process request");
return false;
}
if (incoming.getJMSReplyTo() == null) {
getLogger().warn("JMSReplyTo is not set! Will not process request");
return false;
}
} catch (JMSException e) {
getLogger().warn(
"Failed to read JMSCorrelationID/JMSReplyTo. " +
"Will not process request. Exception message = {}", e.getMessage());
return false;
}
return true;
}
示例2: onMessage
import javax.jms.Message; //导入方法依赖的package包/类
@Override
public void onMessage(Message request) {
try {
LOG.info("Received '{}' request on '{}'", ((TextMessage) request).getText(), request.getJMSDestination());
// get the replyTo from the request as response destination
Destination replyDestination = request.getJMSReplyTo();
// create and send response
TextMessage replyMessage = session.createTextMessage("MyResponse");
replyProducer.send(replyDestination, replyMessage, this);
} catch (JMSException e) {
e.printStackTrace();
}
}