Skip to content

Commit

Permalink
changed concurrency. removed channel transacted
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsilaghi committed Nov 12, 2024
1 parent 60fdee6 commit c291664
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-ipc</artifactId>
<version>1.0.3</version>
<version>1.0.6</version>
<name>webprotege-ipc</name>
<description>Inter Process Communication framework</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
@Bean(name = "asyncRabbitTemplate")
@ConditionalOnProperty(prefix = "webprotege.rabbitmq", name = "commands-subscribe", havingValue = "true", matchIfMissing = true)
public AsyncRabbitTemplate asyncRabbitTemplate(@Qualifier("rabbitTemplate") RabbitTemplate rabbitTemplate, SimpleMessageListenerContainer replyListenerContainer) {
return new AsyncRabbitTemplate(rabbitTemplate, replyListenerContainer, getCommandResponseQueue());
var asyncRabbitTemplate = new AsyncRabbitTemplate(rabbitTemplate,
replyListenerContainer,
getCommandResponseQueue());
asyncRabbitTemplate.setReceiveTimeout(rabbitMqTimeout);
return asyncRabbitTemplate;
}


Expand All @@ -105,6 +109,8 @@ public SimpleMessageListenerContainer replyListenerContainer(ConnectionFactory c
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueues(replyQueue);
container.setChannelTransacted(false);
container.setConcurrency("15-20");
return container;
}

Expand All @@ -120,15 +126,17 @@ public SimpleMessageListenerContainer messageListenerContainers() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setQueueNames(getCommandQueue());
container.setConnectionFactory(connectionFactory);
container.setChannelTransacted(false);
container.setMessageListener(rabbitMqCommandHandlerWrapper());
container.setConcurrency("15-20");
return container;
}

@PostConstruct
@ConditionalOnProperty(prefix = "webprotege.rabbitmq", name = "commands-subscribe", havingValue = "true", matchIfMissing = true)
public void createBindings() {
try (Connection connection = connectionFactory.createConnection();
Channel channel = connection.createChannel(true)) {
Channel channel = connection.createChannel(false)) {
channel.exchangeDeclare(COMMANDS_EXCHANGE, "direct", true);
channel.queueDeclare(getCommandQueue(), true, false, false, null);
channel.queueDeclare(getCommandResponseQueue(), true, false, false, null);
Expand Down

0 comments on commit c291664

Please sign in to comment.