Unable to get connection from spring boot application

JulianGreculescu
JulianGreculescu Member Posts: 4
edited August 2021 in General Discussions #1

I am in the process of evaluating solace as an alternative to Kafka which we use as an integration bus at the moment to connect our spring boot micro services. Reason Kafka does not support XA and we had situations when we were losing messages.

I am running a solace docker container on port 8283 and I am able to connect to the admin interface and create queues, etc.

I cannot use solace-jms-spring-boot-starter as a dependency because we also need connectivity to a legacy IBM MQ queue manager which we need to integrate with some external systems. I added sol-jms as a dependency instead and manually created the ConnectionFactory and JmsTemplate beans as below:

` @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 Solace", e));
    return cachingConnectionFactory;
}


@Bean("solaceConnectionFactory")
public ConnectionFactory solaceConnectionFactory() throws Exception {
    var connectionFactory = SolJmsUtility.createConnectionFactory();
    connectionFactory.setHost("localhost:8283");
    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;
}

`
Then when I try o send a message it fails to open a connection with the error below:

Error creating connection - transport error ((Client name: C02XN27DJG5H/87040/003f0002/FSaKrIZNbc Local addr: 127.0.0.1 Local port: 53187 Remote addr: localhost Remote port: 8283) - Error communicating with the router.)

Any idea what I am doing wrong and how should I fix my issue? I am pretty new to solace and this might be a basic question so please be patient.

Thank you in advance.

Julian

Tagged:

Best Answer

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee
    #2 Answer ✓

    I believe it is because you are connecting on your admin port. In your broker Manager you should be able to see what port smf (the Solace messaging protocol) is running on. By default, non-TLS would be port 55555.

    Also make sure that port is mapped/exposed in your Docker config.

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee
    #3 Answer ✓

    I believe it is because you are connecting on your admin port. In your broker Manager you should be able to see what port smf (the Solace messaging protocol) is running on. By default, non-TLS would be port 55555.

    Also make sure that port is mapped/exposed in your Docker config.

  • JulianGreculescu
    JulianGreculescu Member Posts: 4

    OMG this was so quick. I feel like I am going to love this new kid. Thanks s a lot. I was able to open a connection.