Why not spring amqp provider a sendAndAsyncReceive method signature? - spring

Sometime we need send a message asynchronous and provide a callback when message result asynchronous returned.
Now,there is only blocking method sendAndReceive;why not provider a sendAndAsyncReceive method by pass a callback arg or return a listentablefuture?

Because nobody has asked for it.
You can use send() and configure an async consumer (SimpleMessageListenerContainer) to receive the replies.
Feel free to open a new feature JIRA issue or, even better, consider contributing.
EDIT:
Here's a gist with sample code.

Related

ColdFusion API and Websockets

I am hoping someone can point me in the right direction. I have a CF2021 Server which uses a Node.js websocket server and CF pages (via javascript) as a client. Messages from user to user work as expected, so no issue there.
This CF Server also has a custom API built using CFML that handles and routes inbound SMS messages. My question is; what would be the best way to send the SMS message (by now its json) to the Node.js websocket to it can send it to the user(s).
I tried using the same javascript that the browser client uses, but it appears that the CFML API script is "browser-less", so that doesn't work, or should it?
I thought something like Apache Groovy may be the solution, but I am having difficulties with any websocket example I have found.
Any suggestions would be greatly appreciated.
thanks in advance
Flow matters.
If you want to handle an incoming message by delivering it to all currently logged in users who are subscribed to messages of the current sort: set up your message handler to deliver using lucee/adobe-coldfusion websockets. Be forewarned, Lucee takes some setup time, but once running, it is a great solution.
If you don't need immediate delivery, or you need a super simple solution: I actually have had some success with "Long Polling" you just have to remember to use "flush" early in the request, before any pause/sleep, then loop your message lookup requests for new data, with a 1-5 second delay between each loop. Once new data is found, I like to return the request to the client, close that polling request and start a new polling request using the client side. I typically won't poll for more than 60 seconds. Even if the returned json object is empty.

How does Apache Camel AS2 handle async mdn

i have a very simple route as a as2 server:
from("as2://server/listen?serverPortNumber=7777&requestUriPattern=/").id("as2Listener").bean(AS2Controller.class);
when i receive an async mdn from my partner, I see in the log that the AS2 Server components receive an incoming as2 request and it process the request, but it doesn't get into the process method in my controller class (normal as2 messages from my partner gets process in the process method in the controller class no problem). Can anyone help with where the mdn message gets processed in the whole flow?
Thanks!
Edit:
Normal AS2 Request can get process fine, but when I receive a MDN message, it doesn't get passed into my controller, instead there is this error before and it quits before passing it over:
The Error Message I get when I receive a mdn message
If you are developing the code on Spring Boot, you can call bean method by "as2controller" (which you give the name) or you can autowire the class and call it directly.
#Autowired
AS2Controller as2controller ;
//.bean(as2controller);
More info, https://camel.apache.org/components/latest/bean-component.html

RabbitTemplate not returning the message back to caller

I have project microservice where I have restful call which calls the endpoint in Service microservice.
Currently I have a problem where Service return the message back to API in the middle RabbitTemplate's method handleDelivery() not able to pass on the message to the caller back in the restful program. I.e. the message is disappearing somewhere never returns back.
So I am stuck and not able to proceed with this.
How do I fix/over come this problem.
Your help is highly appreciated.
thank you.
~Shyam

Multiple subscribe not working with enableProtocol:true

I am using atmosphere jersey with redis broadcaster.
When I keep enableProtocol:true in javascript, the first subscribe request is successful.
But when I send next subscribe request I get Continuation Frame warning. I tested on Google chrome. I have attached the snapshot.
What could the issue be?
It works when I keep enableProtocol:false. But then onDisconnect is not called in long-polling.
After some observation I found that the X-Atmosphere-tracking-id=0 in first request and in subsequent requests I get it as the tracking id of previous request.
How do I avoid this?
You can try by manually setting the tracking-id to 0 before each subscribe.
$.atmosphere.uuid = 0

Calling dispatch in subscribe in Autobahn

I am using Autobahn and I have an implementation-specific question.
I am trying to figure out how to send a notice to all connected clients (including the newly subscribed client) upon a client subscribing to a topic. Here's the code (edited down for clarity):
#exportSub("", True)
def subscribe(self, topicUriPrefix, topicUriSuffix):
topic_uri = "%s%s" % (topicUriPrefix, topicUriSuffix)
self.client.dispatch(topic_uri, {"msg":"WTF"})
return True
Yet, I'm not seeing the newly subscribed message receive this dispatch. The dispatch call is returning None.
What's happening here?
I figured this out. A client must first be subscribed to a topic before receiving a message sent via dispatch(). This means that the dispatch() cannot be called inside subscribe if one expect the subscribing client to receive the message. I worked around this problem by building a simple message queue and calling dispatch on the protocol instance for any queued messages.

Resources