Read message from multiple service bus topics subscription using logic app - azure

I have scenario that I want to read all messages from all topics a and a specific subscription using azure logic app connector.
Example: topic ATopic, BTopic has a same name "TestSubscription" subscription
Using azure logic app I want to read all topics messages on above "TestSubscription"
I have mark in read in below image at particular place I want a dynamic topic name

The common pattern for scenarios like this is to have a Logic App for each Trigger/Topic/Subscription.
Then these Logic Apps, two in your case, call a third work Logic App which does any real message processing.

You can use the Event Grid trigger if you have Service Bus premium, to subscribe to Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners event. Once the Logic App is triggered, you can then use the Service Bus action to retrieve the actual message and process it.

Related

How to collect results from multiple azure app services and push to a topic

I have 3 Azure service bus topics, 3 azure app services subscribe to these topic messages and perform some actions and return results.
I want to push a message to another topic with the collective results (failure/success) from the above 3 app services.
How can this be achieved?
The sample flow chart below:
One of the options to solve this is to leverage the Azure Service Bus Message Sessions feature. It allows handling messages and keeping the state using a single service. You'd have 3 message types (events) published by the upstream services (Payment, Email, and Notification), and a fourth message type, a timeout. This is also known as a saga pattern. I've described the implementation with Azure Service Bus in detail in this blog post.

Azure Service Bus Single Service having Multiple Topic and Subscriber

I have an Micro-Service which is a Consumer/Subscriber service, that receives messages from other 2 Services.
So, I want this Micro-Service to Subscribe from the other 2 micro-services that have different Topic and Subscription.
The constructing/Initializing the service/Azure Service Bus Properties is as below :
services.AddServiceBusNotifications(Configuration, "Communication");
services.AddServiceBusNotifications(Configuration, "SSO");
And the code for Subscribing to this 2 services is as below:
var eventBus = applicationBuilder.ApplicationServices.GetRequiredService<IEventBus>();
eventBus.Subscribe<MeetinginviteCreatedEvent, MeetinginviteCreatedEventHandler>();
eventBus.Subscribe<NewUserCreatedEvent, NewUserCreatedEventHandler>();
So, both the above 2 lines are taking the settings(Topic/Subscription) from the same topic & Subscriber, but I want to take the Topic and Subscription for 2 different Microservices.
How Can I use the Same Subscriber for Multiple Topic and Subscription(Different Microservices).
I have followed the code from the URL : https://github.com/pmchlk/service-bus-messaging
There is a lot going in the code that you've shared since you have a wrapper around the Azure Service Bus SDK but if my understanding of it is correct, one way to solve your issue is to simply forward messages from the individual subscriptions into another topic/subscription and use that in your service.
This would be simpler if it works like I expect it to, based on my understanding of your code.
The other options would be to either change your Dependency Injection code to register transient Event Bus objects instead of a singleton or update your Event Bus class to handle multiple subscriptions. Both of these would require quite a few changes in your custom implementation.

how to send a message to azure service bus Topic (subscription using) Logic app send message connector?

I have a Azure service bus Topic with two subscriptions.
I want to send a message to topic from logic app using send message connector. How to send the message to a specific subscription.
Now it takes only topic name and does not have property to accept subscription name, how can i implement the same.
thanks in advance.
Unfortunately, that is not possible (just not with logic apps, but in general)
This is how a topic and subscription works.
A Service Bus topic provides an endpoint for sender applications to
send messages.
Each subscription of a topic gets a copy of the message sent to the topic.
Topics and subscriptions provide a one-to-many form of communication.
Having, said that you can configure filters at the Subscription end. This will facilitate receiving only those messages meeting the criteria from the central pool. When you want a specific subscription to receive it. You could send the message such a way that it matches the filter condition.
So, something like this :
Image Source
100 messages are sent to the topic, but are split to each subscription as 30,45,25 based on the filter rule. the messages that did not meet filter are not made available to the subscription.
In your case, you need set filters for both the subscription. Trigger the message such a way that it matches only for one of the subscription.
Alternatively, if it is going 1:1 - you could make use of the Queue.
References to set up filters at subscription level :
Filters Service Bus
Filtering the Service Bus
Stackthread on the implementation
A subscription in Service Bus is an isolated view into the messages of a Topic, essentially a copy of the messages private to the subscription. This allows multiple consumers to process topic messages without competing with one another.
You can't publish messages messages directly to a subscription, only to the topic that the subscription is associated with. All subscriptions associated with the topic will have access to the message.
If you are looking to send messages for a single consumer (or a set of competing consumers), a Service Bus queue may be a better fit for your scenario.

Azure Service Bus Topic Subscription REST API

How do I use Azure REST APIs to subscribe to a service bus topic? I want to create a subscription with "Enable Sessions" as the ordering of messages is very important for me. I have the below code that works now, that registers a message handler.
subscriptionClient.RegisterSessionHandler(ProcessMessagesInSessionAsync, sessionHandlerOptions);
However, I want to implement this using REST API. Is this possible?

Can we subscribe an email ID or Cell number as subscriber to Azure event hubs/notification hubs?

In my python application, if any bad/good event happens, I want to send the event details as notification message to user's email addresses or phone #s that have been subscribed to this application. So I am looking for publisher-subscriber model azure cloud
Looks like multiple Azure services achieving similar goal but having a thin line of differences. Event hubs and notification hubs seems promising. So my question is as follows:
Can email ID/phone # be subscribed to Azure event hub and receive the message being sent/produced to Azure event hub?
If not event hub, what is the correct option? Can I achieve it with Service bus or Notification hub?
In AWS, there is a service called SNS (Simple Notification Service) where one can subscribe email/phone number and opt for receiving event messages about that application. I am looking for equivalent to that in Azure.
You can use the Azure Logic Apps / Azure Functions with Event Hubs to achieve this easily.
Using logic apps you can do like simple as below image.
Logic Apps has many in-build connectors for most all Azure Services, you can use Event-hubs,Service bus,SQL etc.,
You can find all the list of available connectors here
Update 1
Once you connected the Event-Hubs to send an Email connector, you will automatically get all the available source data from event-hubs to email task. See below
You can achieve this by using Azure Application Insights. With this, you will be able to monitor your application and receive alerts during application unavailabillity, failures or even during performance issue.
Check this https://learn.microsoft.com/en-us/azure/application-insights/app-insights-tutorial-alert

Resources