diff --git a/pom.xml b/pom.xml
index 63fc33e..de624ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
edu.stanford.protege
webprotege-ipc
- 1.0.3
+ 1.0.5
webprotege-ipc
Inter Process Communication framework
diff --git a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/CommandExecutorImpl.java b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/CommandExecutorImpl.java
index dded056..8ae293b 100644
--- a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/CommandExecutorImpl.java
+++ b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/CommandExecutorImpl.java
@@ -65,7 +65,7 @@ private R handleResponse(Message rabbitResponse) {
if(exception != null) {
try {
- logger.error("Found error on response " + exception);
+ logger.error("Found error on response {}. Action : {}" ,exception, rabbitResponse.getMessageProperties().getHeaders().get(Headers.METHOD));
throw objectMapper.readValue(exception, CommandExecutionException.class);
} catch (JsonProcessingException e) {
logger.error("Error ", e);
diff --git a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventDispatcher.java b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventDispatcher.java
index c412b4a..5b33419 100644
--- a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventDispatcher.java
+++ b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventDispatcher.java
@@ -51,7 +51,6 @@ public void dispatchEvent(Event event) {
message.getMessageProperties().getHeaders().put(PROJECT_ID, projectId);
}
eventRabbitTemplate.convertAndSend(RabbitMQEventsConfiguration.EVENT_EXCHANGE, "", message);
- logger.info("Sent event message!");
} catch (JsonProcessingException | AmqpException e) {
logger.info("Could not serialize event: {}", e.getMessage(), e);
}
diff --git a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventHandlerWrapper.java b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventHandlerWrapper.java
index 51b527c..ea1417b 100644
--- a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventHandlerWrapper.java
+++ b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMQEventHandlerWrapper.java
@@ -28,7 +28,6 @@ public RabbitMQEventHandlerWrapper(List> eventHand
@Override
public void onMessage(Message message) {
- logger.info("Handling event with id {}", message.getMessageProperties().getMessageId());
EventHandler eventHandler = eventHandlers.stream()
.filter(handler -> {
String channel = String.valueOf(message.getMessageProperties().getHeaders().get(CHANNEL));
diff --git a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqCommandHandlerWrapper.java b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqCommandHandlerWrapper.java
index f2ea7ad..e722a99 100644
--- a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqCommandHandlerWrapper.java
+++ b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqCommandHandlerWrapper.java
@@ -46,8 +46,6 @@ public RabbitMqCommandHandlerWrapper(List handler,
private void handleAndReplyToRequest(CommandHandler handler, Channel channel, Message message, UserId userId, Q request, String accessToken) {
var executionContext = new ExecutionContext(userId, accessToken);
+ long startTime = System.currentTimeMillis();
+
try {
var response = handler.handleRequest(request, executionContext);
response.subscribe(r -> {
replyWithSuccessResponse(channel, message, userId, r);
+ long endtime = System.currentTimeMillis();
+ logger.info("Request executed " + request.getChannel() + ". Time taken for Execution is : " + (endtime-startTime) +"ms");
+
}, throwable -> {
if (throwable instanceof CommandExecutionException ex) {
logger.info(
@@ -183,14 +185,23 @@ private void handleAndReplyToRequest(CommandHandler handler, Channel channe
throwable.getMessage(),
request);
replyWithErrorResponse(message,channel, userId, ex.getStatus());
+ long endtime = System.currentTimeMillis();
+ logger.info("Request failed " + request.getChannel() + "with error " + throwable.getMessage() + ". Time taken for Execution is : " + (endtime-startTime) +"ms");
}
else {
replyWithErrorResponse(message, channel, userId, HttpStatus.INTERNAL_SERVER_ERROR);
+ long endtime = System.currentTimeMillis();
+
+ logger.info("Request failed " + request.getChannel() + "with error " + throwable.getMessage() + ". Time taken for Execution is : " + (endtime-startTime) +"ms");
+
}
});
} catch (Throwable throwable) {
logger.error("Uncaught exception when handling request", throwable);
replyWithErrorResponse(message, channel, userId, HttpStatus.INTERNAL_SERVER_ERROR);
+ long endtime = System.currentTimeMillis();
+ logger.info("Request failed " + request.getChannel() + ". Time taken for Execution is : " + (endtime-startTime) +"ms");
+
}
}
diff --git a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqConfiguration.java b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqConfiguration.java
index f425d9f..3d795e6 100644
--- a/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqConfiguration.java
+++ b/src/main/java/edu/stanford/protege/webprotege/ipc/impl/RabbitMqConfiguration.java
@@ -86,7 +86,7 @@ DirectExchange exchange() {
@ConditionalOnProperty(prefix = "webprotege.rabbitmq", name = "commands-subscribe", havingValue = "true", matchIfMissing = true)
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
- rabbitTemplate.setReplyTimeout(rabbitMqTimeout);
+ rabbitTemplate.setReplyTimeout(120000);
rabbitTemplate.setExchange(COMMANDS_EXCHANGE);
return rabbitTemplate;
}
@@ -94,7 +94,9 @@ 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());
+ AsyncRabbitTemplate response = new AsyncRabbitTemplate(rabbitTemplate, replyListenerContainer, getCommandResponseQueue());
+ response.setReceiveTimeout(120000);
+ return response;
}
@@ -105,6 +107,7 @@ public SimpleMessageListenerContainer replyListenerContainer(ConnectionFactory c
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueues(replyQueue);
+ container.setConcurrency("15-20");
return container;
}
@@ -121,6 +124,7 @@ public SimpleMessageListenerContainer messageListenerContainers() {
container.setQueueNames(getCommandQueue());
container.setConnectionFactory(connectionFactory);
container.setMessageListener(rabbitMqCommandHandlerWrapper());
+ container.setConcurrency("15-20");
return container;
}