Giter Club home page Giter Club logo

service-bus-event-hub-demo's Introduction

Service Bus, Event Hub and Logic App DEMO

The objective of this DEMO is to showcase the difference in how to integrate Service Bus and Event Hub using an SDK. In addition, we will explore how Logic App can integrate with both the messaging services.

The high level architecture: Architecture

Getting started

Install the packages

  1. Clone the repository
  2. Install the Azure Event Hubs client library using npm
cd event-hub
npm install
  1. Install the Azure Service Bus client library using npm
cd service-bus
npm install

Prerequisites

Create two subscription inside Service Bus

As you can notice from the content of the folder "service-bus/topic/" you can find two receivers. Each receiver is associated two a different subscription. The best way to explore this concept is to create two subscription and a filter read this introduction: Topic filters and actions

This is an snapshot of the one used in this DEMO:

Filter example

Learn how to use the Javscript SDKs for Service Bus and Event Hub

Please read carefully the following guides:

Configure the javascript files

You should now create the connection strings associated to the Event Hub and Service Bus that you created and copy paste it in the relevant files"

/service-bus/topic/sendTopic.js
/service-bus/topic/receivefromsubscriptionAll.js
/service-bus/topic/receivefromsubscriptionRecent.js
/event-hub/event-hub-send.js
/event-hub/event-hub-receive.js

In each of those file, you will find variables at the top of the files where you need to copy paste the connection string.

Configure the Logic App

In this section we will create a Logic App with the following logic: logicApp

  1. Please create a HTTP request trigger Logic App. You can follow this example. The message payload that you can use to generate the payload is the following:
{
  "isEvent" : "Y",
  "body": "Galileo"
}
  1. After the HTTP trigger, please create a condition with this basic logic: Condition

  2. In this step, you should create the Service Bus and Event Hub action to send message in the respective queues. Please check the images and the guides below: Connectors**** Integrate Logic app with Event Hubs Integrate Logic app with Service Bus

  3. In the last step you should provide a response to your client: Response

Test it

The overall flow should be the following: Demo Architecture

You can test the service-bus with the following commands:

cd /service-bus/topic
node receivefromsubscriptionAll.js
node sendTopic.js

You can test the event-hub with the following commands:

cd /event-hub
node event-hub-receive.js
node event-hub-send.js

If you want to test the overall integration, you can use postman. Select the Method POST and as URL the Logic App url. The request body should be set to JSON and you can send the following content to trigger the Event Hub:

{
  "isEvent" : "Y",
  "body": "Galileo"
}

And the following content to trigger the Service Bus:

{
  "isEvent" : "Y",
  "body": "Galileo"
}

service-bus-event-hub-demo's People

Contributors

fdelivamsft avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.