I am unable to get connection to SonicMQ may be because of unavailable Producers/Consurmers. In this case is SonicMQ supports reconnecting after some time interval.
It doesn't matter if producers or consumers are available, you don't directly connect to them or topics or queues; you connect to the SonicMQ broker. Just use the connection factory to handle reconnect, and if you have multiple brokers, configure them like this...the factory handles reconnection on behalf of the client...
QueueConnectionFactory factory =
QueueConnectionFactory("broker1:2506;broker2:2506");
I have not tried this but may be you can have a look at this link Generic Resource Adapter for JMS. It provide options for defining connection pool, with reconnection.
It's not sonic MQ that may support reconnecting it's your client applications.
If you develop it to provide such feature it will work.
Related
Does it make sense to perform producer/consumer connection pooling of kafka clients?
Does kafka internally maintain a list of connection objects initialized and ready to use?
We'd like to minimize time of connection creation, so that there is no additional overhead when it comes to send/receive messages.
Currently we're using apache commons-pool library GenericObjectPool to keep connections around.
Any help will be appreciated.
Kafka clients maintain their own connections to the clusters.
Both the Producer and Consumer keep connections alive to the brokers they are interacting with. In case they stop interacting, after connections.max.idle.ms the connection will be closed. This setting also exists on the broker so you may want to verify with your admin if they changed this value.
So in most cases, once started Kafka clients don't create many new connections but just use the ones created at startup
I'm using the ActiveMQ client library to connect my server application to ActiveMQ. Several different consumers and producers run in individual threads. How should the relationship between ActiveMQConnectionFactory, ActiveMQConnection and ActiveMQSession be?
one connection factory per JVM
one connection to the broker per JVM or n connections, one per consumer
n sessions, one per consumer (the Javadoc seems to strongly suggest this)
Have a look at How do I use JMS efficiently?.
You should also think about using connection pooling.
When we use a client acknowledgement mode in JMS (I am using Websphere MQ and WAS), the MDB sends the acknowledgement to whom (the docs say to the JMS server).
But in this case, the JMS server means what: the WebSphere MQ which actually has all the queues and the messages or the web sphere application server that is connecting to the websphere MQ.
Acknowledgements, no matter the type, are always sent to the JMS server. Message producers and consumers never communicate directly due to the asynchronous nature of JMS.
Are you using connection factories to obtain a connection? If so, look at the broker url configuration in those factories. You should find the connection url points to WSMQ brokers. So, when you get a connection from a connection factory, the client connection goes directly to the JMS server in WSMQ.
Using Java how do i configure ActiveMQ to load balance and reconnect when disconnection occur?
As i understand those configuration should be made on the ActiveMQConnectionFactory object.
To do that, you set the brokerUrl of the ActiveMQConnectionFactory to a failover transport URI;
failover:(tcp://primary:61616,tcp://secondary:61616)
If you only have one broker, the below should be enough, ok for testing of reconnects but for production you'll most likely want more than one;
failover:(tcp://primary:61616)
Unlimited reconnection attempts is the default, but you can tweak quite a few options if you look at the documentation linked above.
I'd like to know how to properly use connection pooling with Active MQ.
Currently I have a Connection Factory that creates a new connection every time I want to send a message.
I'd like to be able to pool Connections so I don't incur the overhead of connecting every time.
you need to use activemq-pool module and PooledConnectionFactory.
See http://activemq.apache.org/spring-support.html for some more info on the topic