Making a request response queue with Azure Java SDK - java

I'm trying to implement something similar to https://code.msdn.microsoft.com/Brokered-Messaging-Request-0ce8fcaf#content in Java, but can't find functionality from the Service Bus Java SDK to match the QueueClient.AcceptMessageSession used in the example.
So how can I make the client to poll the response queue only for messages that match the expected sessionId? Do I need to create a seperate response queue for each client? Or is it best practise to re-insert non matching messages back to the queue?
I'm using the com.microsoft.azure/azure-servicebus maven package version 0.9.3.

Seems that this feature is not supported in the Java SDK because it uses the service bus REST api instead of the WFC api. Topic/Subscription way might be the only way to implement this with the Java SDK.
More detail: https://github.com/Azure/azure-sdk-for-java/issues/246

#HannuHuhtanen, in my mind, I think the solution is that using two JMS connections to seperately connect two service bus queues for a continuous WebJob as server and clients, please try to refer to the tutorial to know how to use JMS with AMQP for ServiceBus.

Related

How to get batch/bulk messages from azure queue without using azure sdk?

i am using createQueueBrowser() of JMS but it is not giving any response, i mean enumerator is null. is there any alternatives for getting bulk message from the azure queue and also are there any ways to traverse the queue without using azure java sdk..
The SDK is just a wrapper around the REST API. You can use that to manage your queue:
https://learn.microsoft.com/en-us/rest/api/storageservices/fileservices/queue-service-rest-api
But I would check if the queue really is empty, before changing over to the REST API from the SDK.
There is a concept azure queue in your description which is not clear for me. I don't know what you said is either Azure Queue Storage or Azure ServiceBus Queue. Based on my understanding, I think azure queue as you said is Azure ServiceBus Queue, not Queue Storage, because only ServiceBus Queue support AMQP via JMS in Java.
For using Service Bus Queue, there are there ways in Java for you.
Using Azure SDK for Java like offical tutorial How to use Service Bus queues said.
Using JMS with AMQP protocol like another offical tutorial How to use the Java Message Service (JMS) API with Service Bus and AMQP 1.0 said.
The last way is using Service Bus Runtime REST based on HTTP protocol if the above two ways are not you want.

RabbitMQ and Spring: how to get all subscriptions

I'm using RabbitMQ, Spring and SockJS.
My app generatea many different messages and posts them to rabbitmq via stomp. This generation requires a lot of resources so I want to know is there any subscriptions to rabbitmq and what kind of subscription it is (I need to know routing keys of this subscriptions) to avoid generating unnecessary messages.
Is there any possibilities to get this information from Spring or any Java client library?
You can find all the information using one or more of the following
command line tool rabbitmqctl
rabbitmq http api
rabbitmq management (web ui)
There is a library to get information from rabbitmq http api https://github.com/rabbitmq/hop

how to send and consume messages in Event hub via rest api

I am new to the Azure EventHub. I wanted to write a simple prototype which can send and receive messages from AzureEventHub via its rest api.
Could you please help me by providing code snippet demonstrating how to use rest api exposed in EventHub for message producing and consuming.
Sorry, im not sure if there is any java examples around be here are a few links that might help:
Here is a little article that explains how you can generate a SasKey (Shared Access Signature). you to send this key along with every request.
http://www.mikelanzetta.com/2014/09/talking-to-eventhub-from-node/
There is a (unofficial) Azure Service Bus JavaScript SDK, maybe this illustrates how its working
It provides following artefacts:
QueueClient
Topic Client
SubscriptionClient
EventHubClient
Here is an article about sending data to an EventHub: using the javascript sdk.
http://developers.de/blogs/damir_dobric/archive/2015/01/26/eventhubs-support-for-azure-servicebus-javascript-sdk.aspx
I'm the (co-)author of https://github.com/noodlefrenzy/node-amqp10 and can verify that there is no RESTful way to consume messages from an Event Hub - you need to use AMQP. There is a JMS binding for AMQP via Qpid-Proton that you can use.
This article https://azure.microsoft.com/en-gb/documentation/articles/service-bus-java-how-to-use-jms-api-amqp/ has details for using it with Service Bus, but it should be similar for Event Hubs. The main difference with Event Hubs is that messages are never "consumed" and come through on several "partitions", so you would need to connect to all of your partitions, and store the offsets as messages come in so you can specify those when you reconnect.
As per my understanding about EVENTHUB, Rest API has been exposed to send data and there are no rest api available to receive data from event hub.
I tried implementing Receiver for event hub using
1. in Java using https://github.com/hdinsight/eventhubs-client
2. In nodejs using https://github.com/noodlefrenzy/node-amqp10

Automating ActiveMQ to enqueue when RESTful API is hit

I'd like to expose a public RESTful API and either configure our ActiveMQ instance (is possible) to listen at that API and automatically enqueue a JSON or XML version of those API calls, or configure/write software to translate the API call into a message and enqueue the message to an ActiveMQ queue/topic.
So, in other words:
A third party sends an HTTP request (GET/POST/PUT/whatever) to http://myserver.com/api/enqueue
Either:
ActiveMQ is somehow listening at http://myserver.com/api/enqueue and automatically enqueues a toProcess queue/topic with the API call's body; or
I have some kind of servlet listening at that URL and then pass the request on to some software (either open source Java library or something homegrown) that can extract the HttpServletRequest's body and enqueue it to a queue/topic on the ActiveMQ server
So I ask: does ActiveMQ come with this capability out of the box (initial research indicates it doesn't), or are there any open source libraries that would do this for me, or some part of it for me? Or, am I stuck with a custom homegrown solution? Thanks in advance.
In a simple way, ActiveMQ actually does support HTTP/REST-ish interaction with queues out of the box.
As you did ask for Camel, yes, it does support creating more advanced REST API:s and works very well with ActiveMQ (actually, the Camel Core and JMS modulels is part of ActiveMQ distribution).
My favourite way to create REST APIs with Camel is through restlets.
As Brian Roach said, this should be very straight forward to do in plain java code as well with some helper libs, so don't feel bad about a home grown thing here.

How do I get a java application to subscribe to an NServiceBus publisher?

I've asked Google and searched through the NServiceBus website and forums, but I can't seem to find any prescriptive guidance on how I would write a Java application to subscribe to a publisher. Does anyone have any such link or experience?
This scenario is not well supported out of the box - you'll need to do some infrastructure munging yourself. In general, look at how the proxy is built, and add some gateway-style HTTP communication in the mix, or expose that with a standard .NET webservice.
You could manually send the subscribe message to the publisher over MSMQ, the publisher would then send any relevant messages to your java subscribers input queue. But you would need to receive those manually also.
I guess you're then committed to using MSMQ as your transport layer for your entire bus also.

Categories

Resources