Try PubSub+
If you haven't already, check out our new Developer Portal! You'll find useful information about Solace PubSub+ as well as handy resources to get you started.

TcpClientChannel - Channel Closed (smfclient x) - After Publishing Every Message to a Queue

Inder_SinghInder_Singh Member Posts: 1

Questions:
1.) Is this the "proper" way to programmatically create a permanent queue in solace?
2.) How to properly configure a Solace connection factory environment?
3.) What does the message, TcpClientChannel - Channel Closed (smfclient x) signify?

I am getting a TcpClientChannel - Channel Closed (smfclient x) message after every message I produce to a solace queue. I can see that the queue message counter is increasing in the admin portal, but I would like to know what is causing this issue. I am getting the same message when I try to publish to a topic, but the counter only shows 0. I am using camel-k to produce a message to my solace broker. I used the following code to create a Connection Factory, manually create a session to create a queue.

public class createQueueTest extends RouteBuilder {

    public void createQueue() throws Exception{
        SolConnectionFactory testFact = SolJmsUtility.createConnectionFactory();
        testFact.setHost("tcp://malta.corp.sensis.com:31253");
        testFact.setVPN("inder");
        testFact.setUsername("default");
        testFact.setPassword("");
        testFact.setDynamicDurables(true);
        Connection connection = testFact.createConnection();
        System.out.println("connection created");
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        System.out.println("session created");
        Queue queue = session.createQueue("createQueueTest");
        System.out.println("Queue created");
        session.close();
        System.out.println("session closed");
        connection.close();
        System.out.println("connection closed");
    }

    @Override
    public void configure() throws Exception {

        createQueue();
        ConnectionFactory testFact = 
        SolJmsUtility.createConnectionFactory("tcp://malta.corp.sensis.com:31253",
           "default","","inder",null);

        CamelContext context = getContext();
        context.addComponent("test",JmsComponent.jmsComponentAutoAcknowledge(testFact));
        from("timer:ticker")
                .setBody()
                .constant("Hello from Camel-K")
                .to(ExchangePattern.InOnly, "test:queue:createQueueTest")
                .log("Messsage sent to target 1 :: ${body}");
    }
}

I can see that the queue is created in the admin portal and messages queued is increasing. In the terminal output however I am seeing that the connection is being created and closed for every message.

This may be a camel-k issue, where it is creating and closing the session for every message. I have not seen this log message when I publish messages to other JMS Brokers (Artemis), so I am unsure if there is something incorrect with how I've set up my connection factories. Possibly something with the environment variables. I am not seeing the channel closed message when I consume from the solace queue though, only when I publish to the queue.

I have not been able to create a topic or publish to a topic in Solace using camel. I get the same logs as above, but I don't see a topic being created and I don't see the topic's messages queued counter increasing when publishing to an existing topic. I do not get an error stating that the topic does not exist though. Any insights into these problems would be greatly appreciated.

Best Answer

Answers

  • AaronAaron Member, Moderator, Employee Posts: 34 Solace Employee

    Hey there Inder. Ok, I don't know camel-k that well, but I've seen similar issues in other JMS-using applications/frameworks (like Spring) where the connection is not cached... which causes a new connection to be made for every message. Definitely not ideal... you don't want to be connecting/disconnecting all the time. You can verify these connects/disconnects are occuring by looking at the broker's EVENT.LOG... if you can figure out how to get into the container's shell (for docker: sudo docker exec -it <container-name> /bin/bash) (for OVA: login with sysadmin and go into shell). Then navigate to /usr/sw/jail/logs/ directory and tail -f event.log.

    Anyhow, see if you can find some camel-k configuration around caching your connection.

    As for "creating topics" in Solace... that's not how Solace really works... topics are pieces of metadata associated with each individual message... not something you configure on the broker. If you want persistent message flow, (typically) an administrator will configure a queue (in Solace, queue==persistent), and then add a topic subscription to that queue to attract messages.

    Check out this video I made... it describes what topics are in Solace:

  • honghong Administrator Posts: 37 admin

    @Inder_Singh Did Aaron answer your questions? If yes, please accept the answers by clicking "Yes" in the line above "Did this answer the question?". Thanks!

Sign In or Register to comment.