private boolean isTimedOut(final javax.jms.Message request) throws JMSException { if (request.getJMSExpiration() > 0) { ZonedDateTime dateTime = ZonedDateTime.now(ZoneOffset.UTC); long timeToLive = request.getJMSExpiration() - dateTime.toInstant().toEpochMilli(); if (timeToLive < 0) { getLogger() .log(Level.INFO, "Message time to live is already expired skipping response."); return true; } } return false; }
initResponseMessageProperties(outProps, inProps); if (isTimedOut(request)) { return; Destination replyTo = getReplyToDestination(session, inMessage); if (replyTo == null) { throw new RuntimeException("No replyTo destination set"); final String msgType = getMessageType(outMessage, request); String correlationId = determineCorrelationID(request); javax.jms.Message reply = JMSMessageUtils.asJMSMessage(jmsConfig, outMessage,
/** * @param inMessage the incoming message * @return the inbuilt backchannel */ protected Conduit getInbuiltBackChannel(Message inMessage) { //with JMS, non-robust OneWays will never need to send back a response, even a "202" response. boolean robust = MessageUtils.getContextualBoolean(inMessage, Message.ROBUST_ONEWAY); if (inMessage.getExchange().isOneWay() && !robust) { return null; } if (jmsConfig.isOneSessionPerConnection()) { return new BackChannelConduit(inMessage, jmsConfig); } else { return new BackChannelConduit(inMessage, jmsConfig, connection); } }
public void sendExchange(Exchange exchange, final Object replyObj) { if (exchange.isOneWay()) { //Don't need to send anything return; } final Message outMessage = exchange.getOutMessage(); try (ResourceCloser closer = new ResourceCloser()) { send(outMessage, replyObj, closer); } catch (JMSException ex) { throw JMSUtil.convertJmsException(ex); } }