Calling AMQ Listener from APIGEE Proxy end point - jms

I am creating the APIGEE proxy from APIGEE edge. Its target is a Mule deployed application which has no HTTP listener. It is only triggered by AMQ listener. Is there any way to connect to that deployed application and trigger it from APIGEE proxy?
I have tried browsing all the APIGEE blogs, but I'm unable to get the accurate and actual solution.

This question is not about the Mule application, which is just passively expecting incoming messages in an ActiveMQ queue. You need to send a message to that queue from the Apigee Edge proxy. For that I think you need to use a Java callout policy and do the operation in Java code.

Related

Load Balancing ActimeMQ Artemis in JBoss EAP 7.2.0

We are developing an application using Spring Boot and Apache Camel that is reading a message from ActiveMQ Artemis, doing some transformation, and sending it to ActiveMQ Artemis. Our application is deployed as war file in on-premise JBoss EAP 7.2.0. Both the source and target applications are remote to our application and they are also deployed on JBoss EAP 7.2.0. The remote queues to which Camel is connecting are ActiveMQ Artemis which were created in JBoss and connecting using http-remoting protocol. These setup was working when there were only one node of each of the applications.
Now we are making the source and target applications 3 nodes each (i.e. they will be deployed in multiple JBoss servers). For accessing the front-end of the source and target applications we are configuring and accessing them through a load balancer.
Can we configure the load balancer to access the source and target brokers from the Camel layer? There will be 3 source and 3 target brokers. Or is clustering the brokers the only option in this case?
We are thinking of load balancing between the queues and not clustering. Suppose we have three queues q1, q2, and q3 with corresponding brokers b1, b2, and b3. I will configure the load balancer url in the Camel layer like http-remoting://<load-balancer-url>:<port> (much like we do while load balancing HTTP API requests). Any message coming in will hit the load balancer, and the load balancer will decide which queue to route the message to.
JMS connections are stateful. When a client creates a connection there is no indication of the queues to which it will send messages. The load-balancer will have to direct that client's connection to either b1, b2, or b3 and it will have no way to determine where it should go. A load-balancer working with messaging will almost certainly only be able to balance connections, not messages. It sounds like you want load-balancing at the message level instead. Perhaps you should look into something like Qpid Dispatch Router.
Messaging doesn't use HTTP so using an HTTP load balancer like you do with your HTTP API(s) won't work. It's easy for a load-balancer to inspect HTTP headers and route requests, especially since HTTP is stateless. However, messaging connections are stateful and the protocols are typically quite a bit more complex than HTTP. I don't know of any load-balancers that will work the way you are wanting for messaging.
You need your client not to use the topology, you can do this by using "setUseTopologyForLoadBalancing" on your AMQConnectionFactory. If you get the connection factory from EAP I think this is configurable on the connection factory since EAP 7.3.

How should you handle the retry of sending a JMS message from your application to ActiveMQ if the ActiveMQ server is down?

So using JMS and ActiveMQ, I can be sure that my message sent from my Spring Boot application using JmsTemplate will reach it's destination application even if that destination application is down at the time I send the message to ActiveMQ. As when the destination application starts up, it grabs the message from the queue. Great!
However.
What happens if my Spring Boot application tries to send a JMS message to a queue on the ActiveMQ server, but the ActiveMQ server is down at that point or the network is down and I get a connection refused exception?
What is the recommended way to make sure my application keeps trying to re-sends the message to ActiveMQ until it is successful? Is this something I have to develop into my application myself? Are there any nifty Spring tools or annotations which do this for me? Any advice on best practice or how I should be handling this scenario?
You can try Spring-Retry. Has lots of fine grain controls for it:
http://www.baeldung.com/spring-retry
https://github.com/spring-projects/spring-retry
If it is critical that you don't lose this message, you will want to save it to some alternative persistent store (e.g. filesystem, local mq server) along with whatever retry code you come up with. But for those occasional network glitches or a very temporary mq shutdown/restart, Spring-Retry alone should do the trick.
Couple of approaches I can think of
1. You can set up another ActiveMq as fallback. In your code you don't have to do anything, just change your broker url from
activemq.broker.url=tcp://amq01.blah.blah.com:61616
to
activemq.broker.url=failover:(tcp://amq01.blah.blah.com:61616,tcp://amq02.blah.blah.com:61616)?randomize=false
The rest is automatically taken care of. i.e. when one of them is down, the messages are sent to other.
Another approach is to send to a internal queue (like seda, direct) when activemq is down and read from there.
Adding failover to the url is one appropriate way.
And another reasonable way is to making sure activemq always online , as activemq has the master-slave mode(http://activemq.apache.org/masterslave.html) to get high availability.

How to call a OSB Proxy Service(JMS Transport) from a java client?

Hi I have a proxy service of transport type (JMS). It listens to a queue and when a message is posted in IN queue, it will route to a business service which would put the message in an OUT queue.
Now, I have a requirement where, from a java client I want to call the proxy service and pass the message content that it can route to business service which will put the message in out queue.
Is it possible? Is yes, how?
P.S: I searched in the internet about this and found we can call a proxy service just as a web service. Is it possible with JMS transport proxy service ?
A proxy cannot accept both HTTP and JMS at the same time - they are bound to a particular type of transport.
However, you can create a proxy chain like so:
A local-transport proxy (Let's call it MyService-local.proxy) that does the business logic and routes to the business service.
A small proxy that exposes a SOAP or REST endpoint (Let's call it MyService-http.proxy) and routes to MyService-local
Another proxy that reads from a JMS queue (call it MyService-jms.proxy) and routes to MyService-local.
Alternatively, if you dont want to change the OSB service, I suppose you could also write Java code to create a JMS message and put it on the original queue.

Spring Integration handle http outbound gateway failures

There are multiple servers that are listening to activemq. The chain is configured to make the http [outbound gateway] call. Suppose one of the server picks up the message and in-between if the http call fails for some reason. The message should be put back to the queue, so that another server can pick up the message and process. Can this be achieved using Spring Integration. I read lot on Transaction, however unable to find workable way.
Yes, simply set acknowledge="transacted" on the <int-jms:message-driven-channel-adapter/> and, as long as you use only direct channels (no <queue/> on the channel or task-executor on the channel's dispatcher) then any failure will cause the message to roll back.

Oracle Service Bus (OSB) Proxy Service Endpoint URI change

We have an OSB Proxy Service which is currently setup to receive messages from an external jms queue endpoint URI. We have been tasked with creating a JMS bridge over which to receive external messages.
To this end, we have created a bridge with local jms in/out queues and proceeded to edit the OSB Proxy Service's Endpoint URI from that of the old external jms queue to that of our new local bridge's jms queue. However, when we try to activate the changes, we get: Exception in AppMerge flows' progression message.
Being quite new to all things OSB, I am unsure as to what this error means and whether re-pointing a Proxy Service's Endpoint URI from remote jms queue to local bridge's jms queue is enough for what we are attempting to do.
Any thoughts on this matter would be much appreciated!
Our OSB version is 10gR3.
Regards,
PM.
I think your Proxy is not deployed correctly. I think after creating the bridge and queues, restart your server and then try to work.

Resources