VimalKumar
VimalKumar

Reputation: 1850

Apache Camel in a Jboss Cluster

I am new to Apache Camel and planning in implementing a File Poller in the Grails Application to be deployed in the Jboss Cluster of two nodes.

I am planning to use the Grails routing plugin to include Camel.

The question is, since it is a cluster environment, we will have two Camel Contexts correct (one in each node)? If so, both will have the same routes in them. When a file is present in the source folder, will both camel contexts try to process the file? I dont want a situation where both nodes try to process the file and result in a failure. I just want the file to be processed by only one camel context and route. Do i need to do anything special to handle this scenario or the Camel has the ability to work in the cluster?

Upvotes: 2

Views: 549

Answers (1)

Nicholas
Nicholas

Reputation: 16066

You could run your camel context as a jboss clustered singleton.

========================================

Sorry, was responding on mobile. Here's some more info.

It's not that you cannot run the camel context on every node in the cluster (you can), but if all nodes are observing the same file system, and you don't want them squabbling over who gets to process the files dropped in the target directories, your best bet is to have only one instance of the context running at one time.

Since you are already running a jboss cluster [ I assume ], the HA Singleton model seems to be a good fit for you. It will run the camel context on only one instance, but if that instance fails, another node will start the context, so you have a solid chance of always running a context.

Something to look at anyways. Alternatively, you might designate different file masks to each node in the cluster so each context will only pick up files that match the designated file mask.

Upvotes: 1

Related Questions