/** * Creates a {@link org.springframework.jms.core.JmsOperations} object used for one way messaging */ public JmsOperations createInOnlyTemplate( JmsEndpoint endpoint, boolean pubSubDomain, String destination) { if (jmsOperations != null) { return jmsOperations; } ConnectionFactory factory = getTemplateConnectionFactory(); JmsTemplate template = new CamelJmsTemplate(this, factory); template.setPubSubDomain(pubSubDomain); if (destinationResolver != null) { template.setDestinationResolver(destinationResolver); if (endpoint instanceof DestinationEndpoint) { LOG.debug( "You are overloading the destinationResolver property on a DestinationEndpoint; are you sure you want to do that?"); } } else if (endpoint instanceof DestinationEndpoint) { DestinationEndpoint destinationEndpoint = (DestinationEndpoint) endpoint; template.setDestinationResolver(createDestinationResolver(destinationEndpoint)); } template.setDefaultDestinationName(destination); template.setExplicitQosEnabled(isExplicitQosEnabled()); template.setDeliveryPersistent(deliveryPersistent); if (messageConverter != null) { template.setMessageConverter(messageConverter); } template.setMessageIdEnabled(messageIdEnabled); template.setMessageTimestampEnabled(messageTimestampEnabled); if (priority >= 0) { template.setPriority(priority); } template.setPubSubNoLocal(pubSubNoLocal); if (receiveTimeout >= 0) { template.setReceiveTimeout(receiveTimeout); } // only set TTL if we have a positive value and it has not been disabled if (timeToLive >= 0 && !isDisableTimeToLive()) { template.setTimeToLive(timeToLive); } template.setSessionTransacted(transacted); if (transacted) { template.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED); } else { // This is here for completeness, but the template should not get // used for receiving messages. if (acknowledgementMode >= 0) { template.setSessionAcknowledgeMode(acknowledgementMode); } else if (acknowledgementModeName != null) { template.setSessionAcknowledgeModeName(acknowledgementModeName); } } return template; }
@Bean(name = "domainAdminOutgoingOsgpCoreResponsesJmsTemplate") public JmsTemplate outgoingOsgpCoreResponsesJmsTemplate() { final JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setDefaultDestination(this.outgoingOsgpCoreResponsesQueue()); // Enable the use of deliveryMode, priority, and timeToLive jmsTemplate.setExplicitQosEnabled( Boolean.parseBoolean( this.environment.getRequiredProperty( PROPERTY_NAME_JMS_OUTGOING_OSGP_CORE_RESPONSES_EXPLICIT_QOS_ENABLED))); jmsTemplate.setTimeToLive( Long.parseLong( this.environment.getRequiredProperty( PROPERTY_NAME_JMS_OUTGOING_OSGP_CORE_RESPONSES_TIME_TO_LIVE))); jmsTemplate.setDeliveryPersistent( Boolean.parseBoolean( this.environment.getRequiredProperty( PROPERTY_NAME_JMS_OUTGOING_OSGP_CORE_RESPONSES_DELIVERY_PERSISTENT))); jmsTemplate.setConnectionFactory(this.pooledConnectionFactory()); return jmsTemplate; }
public void configure(EndpointMessageListener listener) { if (isDisableReplyTo()) { listener.setDisableReplyTo(true); } if (isEagerLoadingOfProperties()) { listener.setEagerLoadingOfProperties(true); } if (getReplyTo() != null) { listener.setReplyToDestination(getReplyTo()); } // TODO: REVISIT: We really ought to change the model and let JmsProducer // and JmsConsumer have their own JmsConfiguration instance // This way producer's and consumer's QoS can differ and be // independently configured JmsOperations operations = listener.getTemplate(); if (operations instanceof JmsTemplate) { JmsTemplate template = (JmsTemplate) operations; template.setDeliveryPersistent(isReplyToDeliveryPersistent()); } }
@Bean public JmsTemplate osgpRequestsJmsTemplate() { final JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setDefaultDestination(this.osgpRequestsQueue()); // Enable the use of deliveryMode, priority, and timeToLive jmsTemplate.setExplicitQosEnabled( Boolean.parseBoolean( this.environment.getRequiredProperty( PROPERTY_NAME_JMS_OSGP_REQUESTS_EXPLICIT_QOS_ENABLED))); jmsTemplate.setTimeToLive( Long.parseLong( this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_TIME_TO_LIVE))); jmsTemplate.setDeliveryPersistent( Boolean.parseBoolean( this.environment.getRequiredProperty( PROPERTY_NAME_JMS_OSGP_REQUESTS_DELIVERY_PERSISTENT))); jmsTemplate.setConnectionFactory(this.pooledConnectionFactory()); jmsTemplate.setReceiveTimeout( Long.parseLong( this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_RECEIVE_TIMEOUT))); return jmsTemplate; }