How to make qupid consumer exlusive using apache camel? - apache-camel

I am trying to connect single qpid broker via to clients.
I want only one of these two client should listen the qpid queue.
I am trying this with apache camel

I don't believe QPID supports exclusive consumer on queues. An alternative option is to deploy your Camel route in Karaf in a primary+failover setup. The failover karaf container will be running in a "warm" mode where the Camel route is not started. If the primary fails, the failover will take over and start up all Camel routes. Works great for Highly Available database and file pollers as well!
ref: Karaf HA / Cluster setup

Related

Apache Camel single instance of a route running in cluster using database

I have Apache Camel application deployed on two servers and they consume from JMS endpoint. I want to make sure that only one camel route is consuming from jms endpoint at a time. The only option that I can use for clustering is using database as a lock store. Does Apache Camel provide such a feature?
I think the easiest way is to consume from a topic and not a queue.
On connection, use the same subscriptionName. Only the first connection will be allowed as far i know.

ActiveMQ 5.x to Artemis Migration Approach

We are in a plan of migration from 5.x to the newest version (i.e. ActiveMQ Artemis) and we need a couple of clarifications if any one has done or used Camel as client application.
We are currently connecting via Camel ActiveMQ component and I don't see any Artemis component as such in Camel. We do have other components such as JMS, SJMS, AMQP. Any thoughts on which one to go for and recommended for connecting to Artemis? I think I have options of using core, AMQP protocols in new version if want to go away with OpenWire. If core protocol is intended for applications migrating from JBoss, good to go with AMQP component which underneath uses AMQP protocol and conforms to JMS specifications?
There is no Camel component specifically for ActiveMQ Artemis like there is for ActiveMQ 5.x. However, ActiveMQ Artemis supports the OpenWire protocol which is what the ActiveMQ Camel component uses so your client applications don't necessarily need to change.
If you want to change your Camel applications then you can use the JMS or SJMS Camel components with any of the following JMS client implementations:
OpenWire JMS (shipped with ActiveMQ 5.x)
core JMS (shipped with ActiveMQ Artemis)
Qpid JMS (independent JMS client implementation using AMQP)
You can also use the AMQP Camel component with the Qpid JMS client if you like.
Which component you use is entirely dependent on your specific use-case. You haven't really provided any specifics about your use-case so it's impossible to provide guidance there. You'll need to evaluate the pros and cons of each approach and decide for yourself.

Apache-Camel, ActiveMQ, camel-jms and Fuse -> why do I need them?

I am still struggling with undertsanding some of Camel's main features and limitations.
My objective is to implement a demo application that can migrate camel endpoints. To achieve this everyone suggested that I should use the camel load-balancer pattern with the failover construct.
To achieve this objective people have suggested Fuse and ActiveMQ. Some have even suggested JBoss, but I am lost.
I understand that Camel needs the an implementation of a JMS server. To achieve this I can use ActiveMQ - a free implementation of a JMS server.
However camel also provies the jms-component. What is this? Is this a client implementation of JMS? If so, should I not be using an ActiveMQ client for JMS? Could someone provide a working example?
With ActiveMQ and JMS understood I can then try to find out why people suggest Fuse. I want my implementation to be as simple as possible. Why do I need Fuse? The Camel+ActiveMQ combination has the load balancer pattern with the failover mechanism right?
I am lost in this sea of new technologies, if someone could give a direction I would be thankful.
Camel provides two components. The first is the jms component, which is a generic API for working against JMS servers. The other is the activemq component, which uses the activemq API for working with activemq message brokers. The activemq component is the default component within things like servicemix/fuse, using an internal broker (not a networked/external broker).
If you are connecting to activemq, you can use either the activemq component or the jms component. The jms component will not start up a broker automatically, you would need to do this yourself.
Fusesource == JBoss Fuse == Apache ServiceMix + some addons. For argument sake, i'm going to refer to all three of these as ServiceMix.
ServiceMix is an enterprise service bus, you can lookup the term on wikipedia if you're not familiar with the concept. It uses Apache Camel to define routes between your components, implementing a number of integration patterns as you so need. ServiceMix deploys by default with Apache CXF, for JAX-RS and JAX-WS services and Apache ActiveMQ, a JMS message broker. Using Camel, you can tell service mix that when a REST API is called, do a series of steps, each step decoupled from the one before it.
JBoss Fuse (the enterprisey, costs money edition) comes with some additional components around fail over. Some of these are present in servicemix (namely, you can run servicemix in a hot stand by mode, waiting for the primary to go down). The Camel load balancer pattern doesn't really mean anything around replication, except that a message coming from one endpoint can be delivered to any of a set of a N endpoints. http://camel.apache.org/load-balancer.html
On the flipside, take a look at ServiceMix's failover http://servicemix.apache.org/docs/4.4.x/users-guide/failover.html
I think based on your question you're referring to system failure failover (needing to work against a new instance), and not a Camel Loadbalancer component (which is likely where the confusion is coming from, on the community side and your side).
start by reading these...Camel In Action, ActiveMQ In Action

Connect to Sonic ESB using Apache Camel

Can Camel connect to Sonic ESB?
I could not find any camel-sonic integration specific example. That's why I am confused if it is possible at all.
Connecting ESBs in general does not require specific transports since ESBs are connectivity software packages. You could probably pick and choose which transport fits you best and get started.
I had a look at Sonic ESB as I have never worked with it. However I can see a couple of ways you can integrate camel routes with the ESB.
Web services: If you are hosting web services on the Sonice ESB camel is more than capable of calling these web services from a camel route.
JMS: If Sonic ESB can host a JMS route (I am sure it can but could be wrong) you can just send JMS messages from your Camel route to the JMS queues hosted by Sonic ESB.
The JBI Component: Some ESB's such as Apache ServiceMix and OpenESB is based on the JBI standard. IF Sonic ESB uses this standard you should be able to send JBI messages directly to the Sonic ESB system.
Hope this gives you some pointers to look at.

Using ServiceMix to Proxy Remote Web Service

This might be obvious but i just still don't understand how i'd do it with ServiceMix :
An external web service http://mypartner.com/service/partnerService
My platform is for example http://myservicemix.com/
I'd like to use OSGI bundles
Is this what i need ? :
A cxfbc:provider (this is the one that talks to the remote service, just a wsdl in the bundle right ?)
A camel route and transformations to bridge the two
A jaxrs:server (i'd like to expose it as a REST service)
The cxfbc is a JBI component. JBI is essentially dead/legacy, so I suggest to not use that for new projects. You can read more about JBI is dead here: http://gnodet.blogspot.com/2010/12/thoughts-about-servicemix.html
So Apache ServiceMix is the server where you can host your Camel applications. So I suggest to look into how to do a webservice proxy with Camel.
For example there is an example with Camel
http://camel.apache.org/cxf-proxy-example.html
That example is OSGi ready and can be deployed in Apache ServiceMix.
Also check out some of the CXF examples that are shipped with Apache ServiceMix, in the examples directory
The Camel CXF component can do both REST and WS.
Also there is the camel-restlet component for REST support as well: http://camel.apache.org/restlet

Resources