Hi Devs, Maheeka,
Hope that you can share some light on this one.
I noticed that we can have exceptions in case we use an rabbitmq outbound
endpoint with incorrect credentials. This can occur for example if the password
used to connect to rabbitmq was changed in rabbitmq server and not updated in
the WSO2 Proxy/sequence that makes the send to the rabbitmq endpoint.
If this happens we can see an error on the logs, but it looks the actual
payloads/messages are lost. I understand that this may not happen very often
but it can happen. I believe it would be ideal to have this error handled by
the fault sequence. And it doesn’t look to be the case.
My error trace that is presented on the logs is as follow:
TID: [-1] [] [2018-01-24 21:37:11,159] ERROR
{org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory} - [NF_CF]
Could not connect to RabbitMQ Broker. Error while creating connection
{org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory}
com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was
refused using authentication mechanism PLAIN. For details see the broker
logfile.
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:343)
at
com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:58)
at
com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:103)
at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:877)
at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:839)
at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:661)
at
org.apache.axis2.transport.rabbitmq.utils.RabbitMQUtils.createConnection(RabbitMQUtils.java:56)
at
org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory.createConnection(RabbitMQConnectionFactory.java:133)
at
org.apache.axis2.transport.rabbitmq.RMQChannelPool.<init>(RMQChannelPool.java:20)
at
org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory.initializeConnectionPool(RabbitMQConnectionFactory.java:370)
at
org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactoryManager.getConnectionFactory(RabbitMQConnectionFactoryManager.java:95)
at
org.apache.axis2.transport.rabbitmq.RabbitMQSender.getConnectionFactory(RabbitMQSender.java:127)
at
org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:81)
at
org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at
org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
TID: [-1] [] [2018-01-24 21:37:11,160] INFO
{org.apache.axis2.engine.AxisEngine} - [MessageContext:
logID=399f008a24cfba5968f58c11109b21a614b857c9b7e4790c] [NF_CF] Could not
connect to RabbitMQ Broker. Error while creating connection
{org.apache.axis2.engine.AxisEngine}
This trace is logged 3 times because the code is doing a retry on
RabbitMQConnectionFactory.createConnection. When all retries are performed this
method will throw an exception back to the RMQChannelPool .
If we noticed on the source code of the RMQChannelPool we have:
public RMQChannelPool(RabbitMQConnectionFactory connectionFactory, int
connectionPoolSize) {
RMQChannelPool = new LinkedBlockingDeque<>();
try {
Connection connection = connectionFactory.createConnection();
for (int i = 0; i < connectionPoolSize; i++) {
com.rabbitmq.client.Channel channel =
connection.createChannel();
RMQChannelPool.add(new RMQChannel(connection, channel));
}
} catch (IOException e) {
log.error("Exception occurred while creating connection", e);
}
}
This code is doing a catch and just logging a message with the exception. So
the exception stops at this point.
Looking at the code that it looks to me that the channels are not created and
nothing gets delivered. I didn't manage to follow the send message code
sequence but I suspect that it is returning success because I don’t see any
error on the logs. I assume that it is because of some lucky combination of if
statements. For sure the message is not being delivered to rabbitmq since the
password is incorrect. And since there isn’t any other error message and it
doesn’t execute the fault sequence I assume that it is dropping the message.
I have added Maheeka on CC since I notice that he did some work on these code
in the past.
Please me know if you can help.
Many thanks in advance.
Norberto
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev