Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions ServiceBusJS/Scripts/servicebusjssdk-1.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ function QueueClient(config) {
/// 'sasKey': "**cBg=",
/// 'sasKeyName': the name of the key for SAS "device_send_listen",
/// 'timeOut': Defines the timeout in seconds in communication with service bus endpoint.,
/// 'serviceBusForWindowsServer': Defines if client should connect to local ASB instance,
/// 'serviceBusForWindowsServerDomain': Defines domain of local ASB instance,
/// </param>
var m_EntityName = "Please provide the queue name. For example 'customer/orders'";

Expand All @@ -183,6 +185,10 @@ function QueueClient(config) {

var m_SasKeyName = "provide the SAS key name.";

var m_ServiceBusForWindowsServer = false;

var m_ServiceBusForWindowsServerDomain = null;

m_ServiceNamespace = config.namespace;

if (config.name != null)
Expand All @@ -193,6 +199,10 @@ function QueueClient(config) {
m_SasKeyName = config.sasKeyName;
if (config.timeOut != null)
m_Timeout = config.timeOut;
if (config.serviceBusForWindowsServer != null)
m_ServiceBusForWindowsServer = config.serviceBusForWindowsServer;
if (config.serviceBusForWindowsServerDomain != null)
m_ServiceBusForWindowsServerDomain = config.serviceBusForWindowsServerDomain;

if (config.contentType == null)
m_ContentType = "application/json";
Expand All @@ -203,9 +213,16 @@ function QueueClient(config) {
this.brokeredMessage = msg;
}

var createBaseUri = function (entityPath) {
if (m_ServiceBusForWindowsServer) {
return m_ServiceBusForWindowsServerDomain + "/" + m_ServiceNamespace + "/" + entityPath;
} else {
return m_ServiceNamespace + ".servicebus.windows.net/" + entityPath;
}
};

var getUri = function (entityName, head) {
var entityUri = "https://" + m_ServiceNamespace + ".servicebus.windows.net/" + entityName;
var entityUri = "https://" + createBaseUri(entityName);
var uri;
if (head == null)
uri = entityUri + "/messages/?timeout=" + m_Timeout;
Expand All @@ -218,7 +235,7 @@ function QueueClient(config) {
// Creates shared access signature token.
var getToken = function (entityPath) {

var uri = "http://" + m_ServiceNamespace + ".servicebus.windows.net/" + entityPath;
var uri = "http://" + createBaseUri(entityPath);

var endocedResourceUri = encodeURIComponent(uri);

Expand Down