EventHubs support for Azure ServiceBus JavaScript SDK

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives


We published new version of Azure Service Bus Java Script SDK v1.2. This version provides supports for sending of events to Azure Service Bus Event Hubs.

image

Supported features:

  • Sending of messages to the queue
  • Reading of messages from queue
  • Sending of messages to Topic
  • Sending of events to EventHub (NEW)
  • Reading of messages from subscription
  • Abondon
  • PeekLock-Read/PeekDelete-Read
  • Complete
  • Creating Shared Access Token Signatures
  • Custom BrokeredMessage properties
  • CORS

Following sample shows how to send an event to Service Bus Event Hub.

   <script type="text/javascript">
       $(document).ready(
function () {


          
var clear = function () {
               $(
"#result").html(""
);
               $(
"#msgId").html(""
);


           }
        

          
var ehubClient = new EventHubClient(
           {
              
'name'
: ‘eintrachtfrankfurt’,

               // This is by spec a partition key if specified.
              
'devicename': 'jssimulator',

              
'namespace': "mynamespace",
              
'sasKey': "Hakan:)**/bU="
,
              
'sasKeyName': "send_events"
,
              
'timeOut'
: 10,
           });

 


           $(
"#btnSend").click(function () {


              
var eventBody = { "24": txtTemp.value,
                                 
"area"
: “Frankfurt am Main”};

              
var msg = new EventData(eventBody);


          
        ehubClient.sendMessage(msg, function (messagingResult) {
                   $(
"#result"
).html(messagingResult.result);
                   $(
"#eventData"
).html(JSON.stringify(eventBody));
              
});
           });


       });
  
</script>

Open Source Project on GitHub.

Nuget Packages sbjssdk 1.2.0 and sbjssdk 1.2.0 samples.

Related Samples:


1. How to send messages to Service Bus from .NET Microframework (Example Gadgeteer SPIDER):
http://developers.de/blogs/damir_dobric/archive/2014/12/09/iot-and-industrie-4-0-for-sharepoint-part-i.aspx

2. How to build SharePoint and Office 365 Apps which send messages to Service Bus and consume device events in JavaScript Microservice on top of Service Bus messaging.
http://developers.de/blogs/damir_dobric/archive/2014/12/16/iot-and-industrie-4-0-for-sharepoint-part-ii.aspx

3. EventHubDashDemo provides code to visualize how Azure Event Hubs enables very large scale data ingestion from a large number of sources and very high throughput event consumption through the use of partitioned consumers.
https://github.com/juanjperez/EventHubDashDemo

Related Articles

1. Introduction in SBJSSDK:
http://developers.de/blogs/damir_dobric/archive/2014/08/07/welcome-azure-servicebus-javascript-sdk.aspx

2. Jumpstart SBJSSDK
http://developers.de/blogs/damir_dobric/archive/2014/08/12/jumpstart-azure-service-bus-javascript-sdk.aspx


Posted Jan 26 2015, 10:29 PM by Damir Dobric
developers.de is a .Net Community Blog powered by daenet GmbH.