use of org.springframework.jms.support.QosSettings in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method assertDefaultJmsConfig.
private void assertDefaultJmsConfig(AbstractMessageListenerContainer container) {
assertThat(container.getConnectionFactory()).isEqualTo(this.connectionFactory);
assertThat(container.getDestinationResolver()).isEqualTo(this.destinationResolver);
assertThat(container.getMessageConverter()).isEqualTo(this.messageConverter);
assertThat(container.isSessionTransacted()).isTrue();
assertThat(container.getSessionAcknowledgeMode()).isEqualTo(Session.DUPS_OK_ACKNOWLEDGE);
assertThat(container.isPubSubDomain()).isTrue();
assertThat(container.isReplyPubSubDomain()).isTrue();
assertThat(container.getReplyQosSettings()).isEqualTo(new QosSettings(1, 7, 5000));
assertThat(container.isSubscriptionDurable()).isTrue();
assertThat(container.getClientId()).isEqualTo("client-1234");
assertThat(container.isAutoStartup()).isFalse();
}
use of org.springframework.jms.support.QosSettings in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method setDefaultJmsConfig.
private void setDefaultJmsConfig(AbstractJmsListenerContainerFactory<?> factory) {
factory.setConnectionFactory(this.connectionFactory);
factory.setDestinationResolver(this.destinationResolver);
factory.setMessageConverter(this.messageConverter);
factory.setSessionTransacted(true);
factory.setSessionAcknowledgeMode(Session.DUPS_OK_ACKNOWLEDGE);
factory.setPubSubDomain(true);
factory.setReplyPubSubDomain(true);
factory.setReplyQosSettings(new QosSettings(1, 7, 5000));
factory.setSubscriptionDurable(true);
factory.setClientId("client-1234");
factory.setAutoStartup(false);
}
use of org.springframework.jms.support.QosSettings in project spring-framework by spring-projects.
the class MessagingMessageListenerAdapterTests method replyWithCustomTimeToLive.
@Test
public void replyWithCustomTimeToLive() throws JMSException {
Session session = mock(Session.class);
Queue replyDestination = mock(Queue.class);
given(session.createQueue("queueOut")).willReturn(replyDestination);
MessageProducer messageProducer = mock(MessageProducer.class);
TextMessage responseMessage = mock(TextMessage.class);
given(session.createTextMessage("Response")).willReturn(responseMessage);
given(session.createProducer(replyDestination)).willReturn(messageProducer);
MessagingMessageListenerAdapter listener = getPayloadInstance("Response", "replyPayloadToQueue", Message.class);
QosSettings settings = new QosSettings();
settings.setTimeToLive(6000);
listener.setResponseQosSettings(settings);
listener.onMessage(mock(jakarta.jms.Message.class), session);
verify(session).createQueue("queueOut");
verify(session).createTextMessage("Response");
verify(messageProducer).send(responseMessage, jakarta.jms.Message.DEFAULT_DELIVERY_MODE, jakarta.jms.Message.DEFAULT_PRIORITY, 6000);
verify(messageProducer).close();
}
use of org.springframework.jms.support.QosSettings in project spring-framework by spring-projects.
the class JmsMessageEndpointManagerTests method customReplyQosSettings.
@Test
public void customReplyQosSettings() {
JmsMessageEndpointManager endpoint = new JmsMessageEndpointManager();
JmsActivationSpecConfig config = new JmsActivationSpecConfig();
QosSettings settings = new QosSettings(1, 3, 5);
config.setReplyQosSettings(settings);
endpoint.setActivationSpecConfig(config);
assertThat(endpoint.getReplyQosSettings()).isNotNull();
assertThat(endpoint.getReplyQosSettings().getDeliveryMode()).isEqualTo(1);
assertThat(endpoint.getReplyQosSettings().getPriority()).isEqualTo(3);
assertThat(endpoint.getReplyQosSettings().getTimeToLive()).isEqualTo(5);
}
use of org.springframework.jms.support.QosSettings in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method processAndReplyWithCustomReplyQosSettings.
@Test
void processAndReplyWithCustomReplyQosSettings() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
QosSettings replyQosSettings = new QosSettings(1, 6, 6000);
container.setReplyQosSettings(replyQosSettings);
MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
processAndReplyWithSendTo(listener, "replyDestination", false, replyQosSettings);
assertListenerMethodInvocation(this.sample, methodName);
}
Aggregations