🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
Info log entry pollutinq application logs
I am in the process of evaluating Solace as an alternative to Kafka. Reason for this is that Kafka does not support XA transactions and in some scenarios we lost messages.
I installed downloaded and managed to successfully start Solace message broker locally in aa docker container. One of our applications successfully produces messages to a Solace queue while another one is successfully consuming it so so far so good.
However on the consumer part I can see this entry popping up in our logs every few milliseconds making the logs unreadable.
c.s.jcsmp.impl.SessionModeSupport : (Client name: C02XN27DJG5H/18407/013b0001/qdYUqogzhc Local addr: 127.0.0.1 Local port: 51923 Remote addr: localhost Remote port: 55555) - Error Response (400) - Already Exists
I can silence the entry from log4j configuration but I am sure this is not the way to go. I am quite sure somewhere something is not configured properly. Here is my spring boot beans configuration:
` @Bean("solaceTemplate")
public JmsTemplate jmsTemplate() throws Exception {
return new JmsTemplate(solaceCachingConnectionFactory());
}
@Bean("solaceCachingConnectionFactory") public ConnectionFactory solaceCachingConnectionFactory() throws Exception { var cachingConnectionFactory = new CachingConnectionFactory(); cachingConnectionFactory.setTargetConnectionFactory(solaceConnectionFactory()); cachingConnectionFactory.setReconnectOnException(true); cachingConnectionFactory.setSessionCacheSize(500); cachingConnectionFactory.setExceptionListener(e -> log.error("ErrorResponse making connection with MQ", e)); return cachingConnectionFactory; } @Bean("solaceConnectionFactory") public ConnectionFactory solaceConnectionFactory() throws Exception { var connectionFactory = SolJmsUtility.createConnectionFactory(); connectionFactory.setHost("localhost:55555"); connectionFactory.setVPN("default"); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); // Enables persistent queues or topic endpoints to be created dynamically // on the router, used when Session.createQueue() is called below connectionFactory.setDynamicDurables(true); return connectionFactory; }`
So what I am doing. wrong and how should I fix the issue. I am very new to Solace so please be patient with me. Thank you in advance for your help.
Julian
Answers
-
Hi @JulianGreculescu ,
I'm not a Spring expert, but I believe that the log entry you're seeing would indicate that your client is repeatedly trying to reconnect to the broker although it already has a connection for that client name open.
I'm wondering, if your code is creating a new connection factory every time it's accessing Solace?
Maybe you need to use a singleton pattern in your constructors and check for an existing connection/connection factory first before creating a new one?Best regards,
Christian0 -
No this was not the case. As you can see in the code I am using a
CachingConnectionFactory
which will cache the connections. What solved my issue wasconnectionFactory.setDynamicDurables(false);
. I believe when dynamic durable is set to true it will create the queue on the fly and if the queue is already there you get that INFO log entry any time an access to that queue happens. For a message listener that would mean lots.I am not sure if my explanation is accurate but I was trying this based on what I found in this documented errors:
static public number ENDPOINT_ALREADY_EXISTS = 124 An attempt was made to create a Queue or Topic Endpoint that already exists. This subcode is only returned if solace.SessionProperties.ignoreProvisionEndpointExists was not set for the current session. Causes: 400 Endpoint Already Exists
It would be good if someone with ore Solace experience will validate or invalidate my theory.
1 -
Hey Julian,
Yes you're theory seems to be correct.
It would not be normal (good practice) for queues to be created by client applications. We often do this in tutorial code to limit the administration to get a code sample to work.
BTW I'm also based in Melbourne do reach out if you need more support with your evaluation.
Derrick1