Quantcast
Channel: Service Bus forum
Viewing all 1916 articles
Browse latest View live

Azure Event Hub Vs Notification Hub

$
0
0

Dear service bus experts,

Can anyone suggest the difference between Azure Event Hub and Notification Hub with a real time sample?

Thanks,


Thanks, SaravanaBharathi.A


Service Bus 1.1 - 401 Unauthorized. InvalidSignature.

$
0
0

I've tried to install Service Bus 1.1 twice now.  Once locally (Windows 7) and once on Windows 2008 Server.   Both machines had previous working versions of 1.1 Preview.   On both setups I have uninstalled the preview AND the databases (invoke-sbFarmUpgrade doesn't seem to work from 1.1 preview to 1.1)

I've exported the client certificates and installed on my client PC.   I'm connecting using full connection string including SharedSecretValue

I can connect fine and view Topics and Queues (or at least I can see that there aren't any yet!)

But I can't create a topic or queue - I get "<16:59:42> Exception: The remote server returned an error: (401) Unauthorized. InvalidSignature: The token has an invalid signature..TrackingId:78470863-7c88-4183-a4ef-52d4ec31f54b_Glb-dev-08,TimeStamp:21/10/2013 15:59:42. Method <CreateQueue>b__7c: retry 10 of 10."

Error shown is from Paolo Salvatori's most excellent Service Bus Explorer 2.1

Can happily use Azure Service Bus no problems, and had no problems with Service Bus 1.1 Preview previously.

Any idea what "The token has an invalid signature" means?

Is it possible for Service Bus Subscription Filter to expiry or reset to true filter ?

$
0
0

Hello,

To define the Problem, I have a Service Bus Resource with me. I create Topic and Subscriptions under this Service Bus via code on it's first run, if topic and subscription are not already found. As a practice, I do not create topic explicitly from Azure Portal.

Code snippet which i use is:

private SubscriptionClient CreateSubscriptionClient(string topicConfig, string subsConfig, string filterConfig)
        {
//TopicName, Subscription Name and Filter for that
//Subscription is read from Cloud Configuration settings
            string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
            var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            string topicName = CloudConfigurationManager.GetSetting(topicConfig);
            string subscriptionName = CloudConfigurationManager.GetSetting(subsConfig);
            string filter = CloudConfigurationManager.GetSetting(filterConfig);

            if (!namespaceManager.TopicExists(topicName))
            {
//Create Topic if Not found
// This would create it on first run
                TopicDescription td = new TopicDescription(topicName);
                td.DefaultMessageTimeToLive = TimeSpan.FromDays(1);
                namespaceManager.CreateTopic(td);
            }

            if (!namespaceManager.SubscriptionExists(topicName, subscriptionName))
            {
 //Create Subscription if not found
// This will Create a new subscription on first run
// with filters as defined in this code block

 SqlFilter filter = new SqlFilter(filter);
                SubscriptionDescription sd = new SubscriptionDescription(topicName, subscriptionName);
                sd.DefaultMessageTimeToLive = TimeSpan.FromDays(1);
                sd.EnableDeadLetteringOnMessageExpiration = true;

//Creates Subscription with Filter defined as above
                namespaceManager.CreateSubscription(sd, filter);
            }

//Create Subscription Client for this Subscription
            var client = SubscriptionClient.CreateFromConnectionString(connectionString, topicName, subscriptionName);

            return client;
        }

Above is the code block which I use to create Topic and Subscription on first run. Subscription and Subscription client is created within it. Messages coming to this topic with applied custom filters only are picked by this subscription client for processing, which is what is expected. this expected behavior is observed  while running this code in development environment and tested.

On another staging environment, this Topic/Subscription is up for a couple of months now. while it displayed appropriate behavior early on, now months after it behaves strangely as in the Subscription Client which is created and returned from code snippet above started picking all messages in that topic. With further diagnosis, with help of Subscription description object, i found out that this Subscription no longer had the filter rule which was used to create it in the first place. it only had a true filter ('1'='1'), and thus subscription client was picking all messages being published to this topic, and thus the cause of my problem scenario.

As this Subscription is never manually created from portal, and only via the code above, I can not think of any reason for the expected filter not to be present in this subscription anymore.

So my questions to community on this to start with are:

  1. With code snippet above as reference, is it possible that when this Subscription was created, it may not actually had the expected filter to it? (highly doubt that, as in all tests it always create subscription with expected filter, but still open to suggestions on this)
  2. Assuming that subscription was created correctly with appropriate expected filter on it, is it possible for it to reset to default ('1'='1')? this subscription being created in a staging environment is not very actively used and remain idle for long time when code is not being tested. Could this cause subscription filters to reset?
  3. Is any time Bound expiry attached with filters on subscription as such? Is there any case where Subscription might be reset at all?

Any insights on this would be highly helpful or any suggestions/direction which community may have from description of this problem. I would be happy to add additional information if needed with context of this problem.

Thanks...

Optimizing Database access in OnMessage callback

$
0
0

Hi everyone,

I'm wondering what is the best way to use a SqlConnection object inside a QueueClient::OnMessage callback when the MaxConcurrencyCalls property form OnMessageOption is bigger than 1?

My concerns are about optimizing Open() / Close() calls.

If I well understand how OnMessage is working (guessed on dicussions read on Internet) for each message, a new Thread is created and the callback provided to OnMessage is called inside that thread. Meaning that I cannot create a "global" SqlConnection and use it inside my callback.

Is OnMessage really working like that? Or is it always the same "threads" which are used from a OnMessage callback call to another (like, X threads pre-created then used and used again)?

If threads are always different, what the best way to optimize database acces inside the callback (I would like to avoid open / close the connection for all messages)?

Maybe OnMessage is not the right way to proceed?

Many thanks for your help,


Connecting ThreadX devices to Azure IOT Hub

$
0
0

This is more of a could do question, i have a ThreadX based RTOS system which supports http using Netx . The tutorials which MS provides does not speak of this system. Can we use Azure IOT Hub / Event hubs to send data to cloud through http with this controller ? Are there any libraries provided to support ?

Using PowerShell to create ‘shared access policies’ on Service Bus QUEUES

$
0
0

I’m struggling to create shared access policies using PowerShell on Service Bus Queues. It works at the Service Bus level but NOT the queue level unless anyone can help?

I have tried:

New-AzureSBAuthorizationRule -Name "Manage" -Namespace $servicebusNamespace -Permission $("Manage", "Listen", "Send") -EntityName $queue -EntityType Queue

and it returns:

New-AzureSBAuthorizationRule : Object reference not set to an instance of an object.

I have also tried various utilising various code snippets calling the .Net assembly Microsoft.ServiceBus.dll e.g.

$CurrentNamespace = Get-AzureSBNamespace -Name $servicebusNamespace
$NamespaceManager = [Microsoft.ServiceBus.NamespaceManager]::CreateFromConnectionString($CurrentNamespace.ConnectionString);
$newkey = [Microsoft.ServiceBus.Messaging.SharedAccessAuthorizationRule]::GenerateRandomKey()
[Microsoft.ServiceBus.Messaging.AccessRights[]] $AccessRights  = [Microsoft.ServiceBus.Messaging.AccessRights]::Send
$AuthorizationRule = [Microsoft.ServiceBus.Messaging.SharedAccessAuthorizationRule]::new("myRule",$newkey, $AccessRights)
$queue = $NamespaceManager.GetQueue($queue)
$queue.Authorization.Add($AuthorizationRule)

Whilst the code executes with no errors, I also don't get any authorization rules!

Can anyone help? Many thanks

Robert

Error in Azure IoT hub Receiver

$
0
0

I copy pasted the code available in the getting started tutorial. I am able to get messages to IoT hub (the quota can show that). However, I am not receiving anything when I create the receiver.

Any thoughts?

Service Bus DB names

$
0
0

Is there a way to specify different names for databases SbGatewayDatabase and SbManagementDB at the time of installation and configuration of SB?

Shilpa


Which types of protocols are supported by Azure Service Bus Relay?

$
0
0

Hello,

I am new to Service Bus Relay. I want to know which protocols are supported by Azure Service Bus Relay like HTTP/REST, SOAP etc.

I want to create two different protocol service clients like SOAP client, HTTP/REST client and connect to the SOAP back office service, then which available Azure Service Bus Relay protocols should I use?

How the conversion between REST message to SOAP message takes place in relay service?

Thanks in advance

How to get Service Bus queue connection string using PowerShell or .Net assembly Microsoft.ServiceBus.dll?

$
0
0

Hi

I need to get the ConnectionString of a Service Bus Queue using PowerShell or at least the using the .Net assembly Microsoft.ServiceBus.dll via PowerShell. I need it to put in a config file. I need the ConnectionString for an actual queue not just the Service Bus itself.

I have tried the code below but the ConnectionString doesn't seem to exist here so I'm not sure where to get it. Can anyone help please?

$CurrentNamespace = Get-AzureSBNamespace -Name $ServiceBusNamespace
$NamespaceManager = [Microsoft.ServiceBus.NamespaceManager]::CreateFromConnectionString($CurrentNamespace.ConnectionString);
$NamespaceManager.GetQueue($Queue) | select -ExpandProperty ConnectionString

Thanks

Robert

Azure Service Bus - Metrics

$
0
0
Hi there,

Apologies if this has been asked before. 

I'm wanting to understand more about the "metrics" available on the Azure Service Bus monitoring graph for a few of our Notification Hubs, e.g. What does "Registration Operations" or "Registration Create Operations" measure? I've done a quick Google search but haven't found anything that I've been able to refer to. Ideally it would be great if I had a list of what each of these metrics meant. I know the basics e.g. GCM Successful or APNS Successful Notifications but have noticed there are stats for other metrics, excpect I'm not totally sure what these indicate/measure. 

Anyone able to direct me into the right direction?

Thanks,
Pierre

Python AMQP authentication for topics

$
0
0

Hi!

I have been trying to get AMQP work from Python (in ubuntu) to Azure bus service topics.

I installed the following packages:

https://pypi.python.org/pypi/qpid-python
https://pypi.python.org/pypi/python-qpid-proton/0.10

Openssl has also been installed.

I am able to import libraries ok but I am having troubles with the authentication. There is e.g. the following document describing the address supposed to be used with subscribe method.

https://azure.microsoft.com/en-us/documentation/articles/service-bus-amqp-python/

The document uses terms:

-username

-password

Some older documentation refers to the connection string like:

amqps://[issuer-name]:[issuer-key]@[namespace].servicebus.windows.net

However, all of the above seems to be outdated. So how the connection string to the subscribe method should actually be generated:

username =-> policy_name ??

password ==> URL encoded Shared Access Signature??

Shared access signature for the the root key is in form (part of the key removed):

'SharedAccessSignature sr=sb%3A%2F%2Ftrenissian.servicebus.windows.net%2F&sig=hnh6Yn1nb%2.....2BhKPPlEG2fwqsk%3D&se=1447334425&skn=RootManageSharedAccessKey'

and URL encoded version of the connection string to subscribe method is in form of (part of the key removed):

amqps://RootManageSharedAccessKey:SharedAccessSignature+sr%3Dsb%253A%252F%252Ftrenissian.servicebus.windows.net%252F%26sig%3Dhnh6Yn1nb....2BhKPPlEG2fwqsk%253D%26se%3D1447334425%26skn%3DRootManageSharedAccessKey@trenissian.servicebus.windows.net/topic_antti_02/Subscriptions/subs_high_antti_02

I have been trying numerous combinations, but none of them seems to work. Traffic to topics and subscriptions with Python SDK using http works just fine.

Do you have up to date documentation that has working example?

BR, Antti

Service Bus Reliability

$
0
0

We've just started dabbling with service bus with MassTransit and we are constantly seeing timeout errors when creating topics and queues.  They show up in the log like this:

System.TimeoutException: The request has timed out after 10000 milliseconds. The successful completion of the request cannot be determined. Additional queries should be made to determine whether or not the operation has succeeded. TrackingId:03f82633-e82a-42b1-8fdd-fcd8c7d11c33,TimeStamp:12/21/2015 11:45:41 PM (Rescuing exception) ---> System.Net.WebException: The request was aborted: The request was canceled.
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](System.IAsyncResult)
    at Microsoft.ServiceBus.Messaging.ServiceBusResourceOperations.EndGet[TEntityDescription](System.I

I'd say we run into this problem about 30-40% of the time when our app starts up, it is incredibly frustrating in dev when it happens and in production is even worse.  I've had Fiddler open a few times when the problem has occurred and this is what the response looks like:

GET /admin/AWESOMESAUCE_iisexpress_bus_1msyyynnzwyb3i1gbdjoc79r8k/?api-version=2015-04
<?xml version="1.0"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Publicly Listed Services</title><subtitle type="text">This is the list of publicly-listed services currently available.</subtitle><id>uuid:9c64bc07-c83e-434a-bd43-69b3a3fa89a0;id=3327</id><updated>2015-12-17T00:20:54Z</updated><generator>Service Bus 1.1</generator></feed>

We have dev and production namespaces, both on the standard plan, and it happens equally as frequently across them.  Does anybody else have this problem?  We are publishing < 100 messages per day at this time, so its not like things should be getting overloaded.  It is unreliable to a completely unbelievable degree, makes me think we are using it in a totally inappropriate way.

OnMessage and lock expired message with multiple consumers

$
0
0

Hi,

I'm venturing into this are and created a sample solution with 1 pulisher console app which adds to the queue, and 1 consumer which implements the OnMessage callback to recieve the items.

When i spin up multiple instances of the consumer console app i can see they are all picking up items from the queue but i get alot of "The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue" errors.

Sometimes i can see in the consumer console output that different consumers pick up the same message which i thought shouldnt be happening. In this case if 2 queues pick up the same item then try executing db calls/web service calls and so on. then one finishes, when the other tries to call CompleteAsync it'll throw exception because the item is already removed from the queue, but my logic has already been executed.

Any help/comments/suggestions are appreciated.

Here is the test code i'm using:

Publisher:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Description;
using System.Threading.Tasks;
using Microsoft.Azure;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;

namespace QueuePublisher
{
    class Program
    {
        private static string connectionString;
        private static NamespaceManager namespaceManager;
        private static string queueName = "TestQueue";

        static void Main(string[] args)
        {
            try
            {
                InitializeAzureQueue();
                SendMessageToQueue();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }

        public static void InitializeAzureQueue()
        {
            connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
            namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
            CreateTestQueue(queueName);
        }

        public static void CreateTestQueue(string name)
        {
            QueueDescription qd = new QueueDescription(name)
            {
                MaxSizeInMegabytes = 5120,
                DefaultMessageTimeToLive = new TimeSpan(0, 1, 0),
                LockDuration = new TimeSpan(0, 5, 0)
            };

            if (!namespaceManager.QueueExists(name))
            {
                namespaceManager.CreateQueue(qd);
            }
        }


        public static void SendMessageToQueue()
        {
            var client = QueueClient.CreateFromConnectionString(connectionString, queueName);

        MessageCountDetails:
            Console.WriteLine("Please enter the number of messages to send:");

            var line = Console.ReadLine();
            if (line.ToLower() == "q") return;

            int value = 0;
            if (int.TryParse(line, out value))
            {
                Console.WriteLine("Creating {0} messages...", value);
            }
            else
            {
                goto MessageCountDetails;
            }

            var list = new List<BrokeredMessage>();

            for (int i = 1; i <= value; i++)
            {
                var message = new BrokeredMessage("Test message " + i);
                message.Properties["TestProperty"] = "TestValue";
                message.Properties["Message number"] = i;
                list.Add(message);
            }

            if (list.Any())
            {
                client.SendBatchAsync(list);
            }

            Console.WriteLine("{0} - Sent {1} messages to the {2} queue", DateTime.Now.ToString(), list.Count, queueName);
            goto MessageCountDetails;
        }
    }
}

Consumer:

using System;
using Microsoft.Azure;
using Microsoft.ServiceBus.Messaging;

namespace QueueConsumer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
                QueueClient Client = QueueClient.CreateFromConnectionString(connectionString, "TestQueue");

                // Configure the callback options.
                OnMessageOptions options = new OnMessageOptions();
                options.AutoComplete = false;
                options.AutoRenewTimeout = TimeSpan.FromMinutes(1);

                Client.OnMessageAsync(async msg =>
                {
                    bool shouldAbandon = false;
                    try
                    {
                        Console.WriteLine("ThreadId: {0}, MessageId:{1}, Body{2}, TestProperty:{3}",
                           System.Threading.Thread.CurrentThread.ManagedThreadId,
                           msg.MessageId,
                           msg.GetBody<string>(),
                           msg.Properties["TestProperty"]);

                        //TODO: at this point do the message processing logic
                        // - eg. db calls, web service calls etc.

                        await msg.CompleteAsync();

                    }
                    catch (Exception ex)
                    {
                        shouldAbandon = true;
                        Console.WriteLine("ThreadId: {0}, Error: {1}", System.Threading.Thread.CurrentThread.ManagedThreadId, ex.Message);
                    }
                    finally
                    {
                        await msg.AbandonAsync();
                    }
                });

            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
            }

            Console.ReadKey();
        }
    }
}



Connecting ThreadX devices to Azure IOT Hub

$
0
0

This is more of a could do question, i have a ThreadX based RTOS system which supports http using Netx . The tutorials which MS provides does not speak of this system. Can we use Azure IOT Hub / Event hubs to send data to cloud through http with this controller ? Are there any libraries provided to support ?


I can't delete Service bus and it always deduct my money from my criedit card.

$
0
0

I have 4 service buses and didn't use them a long time, but they default deduct my money all the time and i can't delete them at all.

Service Bus for Windows Server 1.1 - virtualization requirements

$
0
0
Are there any restrictions with running the service bus nodes on Windows Server virtual machines vs. physical servers? I can't find anything in the system requirements or planning documentation that says one way or the other. I'm assuming since there is no specific guidance against using virtualization, it is a fully supported production deployment scenario. Caveats would be the usual as far as making sure resources (cores, memory, etc.) are allocated properly to support the expected load. Is this correct?

Service Bus and Azure Resource Manager

$
0
0

Hi all,

I am using the ResourceManagementClient to create a service bus namespace. This works well. Next, I need the connectionstring of this newly created service bus namespace to create topics and subscriptions. I need this because I create a full servicebus topology from code. 

Analogue, the same goes for IoTHub. Creating this through ARM (ResourceManagementClient or REST api) is no problem, but getting the connectionstrings is.

How can I get those credentials and connectionstrings through REST api and/or ResourceManagementClient?

thanks

Detect when the ServiceHost has failed

$
0
0

hello,

I am using a azure serviceBus relay and need to detect when this has failed or disconnected.

My server is using the NetTcpRelayBinding in mostly the default settings and successfully registering on azure.  Clients are able to connect to the service and everything works without issues.  Clients generally connect rarely and generally there is nothing connected on the server most of the time.

The problem I am having, is that the server hosting the wcf might lose internet connection for long periods (hours).  After sometime the relay on azure will disappear.  When the internet is re-established the relay does not re-appear on azure and clients can no longer connect to this server.

On the sever - there does not appear to be way to detect this failure?  The ServiceHost object continues to show that it's state is Opened and no faulted event appears to be called. 

Is there a way to detect this failure from the serviceHost object?  Or a way to get the ServieHost to re-establish the relay automatically?

The server is using SAS with listen only permissions, so I am not able to create a client connection from the server to test the client connectivity.

Thanks


matvdl


cc3200 launch pad issues

$
0
0

Hi Team,

I’m working on cc3200 launch pad board with Microsoft azure in windows 7 (32-bit operating system).<o:p></o:p>

I have built the sample project provided in the below link and flashed it in cc3200 launch pad board

https://azure.microsoft.com/en-us/develop/iot/get-started/

1. device select -> TI

2. select a platform -> TI RTOS<o:p></o:p>

3. selected c code<o:p></o:p>

I built simplesample_http example code, After flashing to launch pad board, I was able to connect to IP address
successfully, but following error is visible. 

Starting the simplesample_http example
CC3200 has connected to AP and acquired an IP address.
IP Address: 192.168.43.179
Info: IoT Hub SDK for C, version 1.0.0-preview.7
IoTHubClient accepted the message for delivery
Error: Time:Wed Aug 23 09:48:40 2028 File:../../src/httpapiex.c Fu
nc:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending to
a working state
Error: Time:Thu May 13 16:10:32 2032 File:../../src/iothubtranspor
thttp.c Func:DoEvent Line:1206 unable to HTTPAPIEX_ExecuteRequest
Error: Time:Thu May 13 16:10:32 2032 File:../../src/httpapiex.c Fu
nc:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending to
a working state
Error: Time:Thu May 13 16:10:32 2032 File:../../src/iothubtranspor
thttp.c Func:DoMessages Line:1428 unable to HTTPAPIEX_ExecuteReque
st
Error: Time:Thu May 13 16:10:32 2032 File:../../src/httpapiex.c Fu
nc:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending to
a working state
Error: Time:Thu May 13 16:10:32 2032 File:../../src/iothubtransp
orthttp.c Func:DoEvent Line:1206 unable to HTTPAPIEX_ExecuteRequ
est
Error: Time:Thu May 13 16:10:32 2032 File:../../src/httpapiex.c
Func:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending
 to a working state
Error: Time:Thu May 13 16:10:32 2032 File:../../src/iothubtransp
orthttp.c Func:DoMessages Line:1428 unable to HTTPAPIEX_ExecuteR
equest
Error: Time:Thu May 13 16:10:32 2032 File:../../src/httpapiex.c
Func:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending
 to a working state
Error: Time:Thu May 13 16:10:32 2032 File:../../src/iothubtransp
Please help in resolving this error

Thanks

Rajesh

Viewing all 1916 articles
Browse latest View live