Skip to main content
Skip table of contents

Serverless Environment

It might be necessary in certain situations to run the client application in a serverless environment. A serverless instance is when a client needs to connect to a server even if the server is not available. This might be necessary when it is essential that a client connect with a server in situations where there is a high probability that a server is down Consider the case of a cellular service provider. The service provider has an SMS gateway that interacts with mobile devices by acting as an interface between the JMS server and the mobile phone. The JMS server routes the data ahead. A user uses his mobile phone/PDA or any other hand-held device to send an SMS to another user. This message first reaches the gateway, which has the responsibility of routing this message to another gateway interacting with the mobile device of the recipient, through a JMS server. There is a possibility that the server was down at the time the message is to be forwarded. If such a situation arises, the SMS would be lost.
Alternatively, if the gateway receiving the message from the sender is considered to be a JMS client with Durable Connections enabled, then it stores messages locally when the server is down. This provides a robust and reliable solution where messages are stored in the local cache and subsequently re-routed through the server when it becomes available.
To enable a client application to run in a serverless environment, the following needs to be set in an application:
env.put(FioranoJNDIContext.AllowDurableConnections, "true")
FioranoJNDIContext ic = new FioranoJNDIContext(env);
QueueConnectionFactory qcf = (QueueConnectionFactory)ic.lookupQCF("primaryQCF");
QueueConnection qc = qcf.createQueueConnection();
qc.setClientID("myClient");
QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWL-EDGE);
Queue queue = qs.createQueue("primaryQueue");
This allows client applications to run with Durable Connections enabled in serverless environments.
Note: Consider the case where the 'lookup' of the ConnectionFactory is performed using the lookupQCF() method and a queue is created using the createQueue method in the same session. When the server is running, the connection gets revalidated and if the ConnectionFactory exists on the server, the actual 'lookup' is performed through the server and messages are sent to the appropriate destination from the local cache. If it is found that the server does not allow durable connections after revalidation, then the pending messages are not sent to the server.

Sample Application

Sample applications are available in the following directories of the FioranoMQ installation:
%FMQ Home%\fmq\samples\ptp\Durable Connections
%FMQ Home%\fmq\samples\pubsub\Durable Connections
These samples can be downloaded from www.fiorano.com.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.