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

A request from the client instance has exceeded the maximum message size

$
0
0

Hi All

We've been using the Azure Service Bus for some time, and are currently working up a new update to our system that uses it. The contract type that is transmitted in the BrokeredMessage is relatively simple, containing a string and a byte array. The byte array contains the contents of a file to be processed. The problem is that when I call Send on the QueueClient I am getting the following message:

A request from the client instance has exceeded the maximum message size, and the underlying channel will be recreated. Validate the content size before retrying

I had assumed that this was down to settings on the Queue, but after cocking up my most recent test it looks like this is being thrown by the actual client (using the WindowsAzure.ServiceBus nuget, tested with both versions 5.0.2 and 5.1.0)

(Specifically I realised that the queue an updated connection string pointed to hadn't been created, but the error was the same)
The threshold for this seems to be around the 256KB mark. Do we need to set any specific options or use a different method than .Send() when sending messages of this size?

Thanks in advance

Mark Middlemist

Azure Event Hub Not Connecting

$
0
0

Hi,

I am following this tutorial-  https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-python-get-started-send

to send events to my event hub using Python

The connection string of my Event Hub namespace is in the following format

Endpoint=sb://<eventhubnamespacename>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<AcessKeyvalue>

So, in the above mentioned tutorial, I have replaced tutorial I replaced 

ADDRESS with"amqps://mynamespace.servicebus.windows.net/<myeventhub>"
User="RootManageSharedAccessKey"
KEY="<AcessKeyvalue>"

But everytime , I run into errors with the line client.run

'eventhub.pysdk-ANumber': All clients failed to start.

azure.eventhub.common.EventHubError: Unable to open authentication session on connection b'EHSender-anumber-partition0'.
Please confirm target hostname exists: b'eventhubnamespacename.servicebus.windows.net'

I have even tried replacing amqps with sb (as is actually in the connection string but the same error)

Where am I going wrong? 




Able to send message to queue from my machine but error occurred when I host it on different machine

$
0
0

I am able to send message to queue inside and outside of my company domain. but when I host it on a public server machine(means server that is not joined in our company domain) the below error occurred

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ErrorCode: TimedOut   at Microsoft.Azure.ServiceBus.Core.MessageSender.

Relay Hybrid Connection - Need help

$
0
0

We are facing issues to establish control channel with relay hybrid connection. We referred below URL and it works well with console application however it is not working with web application/web API.

https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-hybrid-connections-dotnet-get-started  

Please note that my application works well with console application as listener. Also, we already verified all relay namespace, access key, connection name, access key are correct.

Issue- While debugging listener application (I am using web API as listener) nothing is happening and not even exception and moving to next line of code when debug hits to below line-

await  listener.OpenAsync(cts.Token);

Below is my whole listener code-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Net.Sockets;
using Microsoft.Azure.Relay;
using System.Threading.Tasks;
using System.IO;
using System.Threading;
using System.Web.WebSockets;

namespace WebAPI.Controllers
{

    public class ValuesController : ApiController
    {

        private const string RelayNamespace = "{Relay Namespace}";
        private const string ConnectionName = "{Connection Name}";
        private const string KeyName = "{Policy Name}";
        private const string Key = "{Key}";
        // GET api/values
        public IEnumerable<string> Get()
        {
            RunAsync().GetAwaiter().GetResult();
            return new string[] { "value1", "value2" };
        }

        private static async Task RunAsync()
        {
            var cts = new CancellationTokenSource();

            var tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(KeyName, Key);
            var listener = new HybridConnectionListener(new Uri(string.Format("sb://{0}/{1}", RelayNamespace, ConnectionName)), tokenProvider);

            // Subscribe to the status events
            listener.Connecting += (o, e) => { Console.WriteLine("Connecting"); };
            listener.Offline += (o, e) => { Console.WriteLine("Offline"); };
            listener.Online += (o, e) => { Console.WriteLine("Online"); };

            // Opening the listener will establish the control channel to
            // the Azure Relay service. The control channel will be continuously 
            // maintained and reestablished when connectivity is disrupted.
            await  listener.OpenAsync(cts.Token);

            string str = "Ping me";
            Console.WriteLine("Server listening");

            // Providing callback for cancellation token that will close the listener.
            cts.Token.Register(() => listener.CloseAsync(CancellationToken.None));

            // Start a new thread that will continuously read the console.
            new Task(() => Console.In.ReadLineAsync().ContinueWith((s) => { cts.Cancel(); })).Start();

            // Accept the next available, pending connection request. 
            // Shutting down the listener will allow a clean exit with 
            // this method returning null
            while (true)
            {
                var relayConnection = await listener.AcceptConnectionAsync();
                if (relayConnection == null)
                {
                    break;
                }

                ProcessMessagesOnConnection(relayConnection, cts);
            }

            // Close the listener after we exit the processing loop
            await listener.CloseAsync(cts.Token);
        }

        private static async void ProcessMessagesOnConnection(HybridConnectionStream relayConnection, CancellationTokenSource cts)
        {
            Console.WriteLine("New session");

            // The connection is a fully bidrectional stream. 
            // We put a stream reader and a stream writer over it 
            // which allows us to read UTF-8 text that comes from 
            // the sender and to write text replies back.
            var reader = new StreamReader(relayConnection);
            var writer = new StreamWriter(relayConnection) { AutoFlush = true };
            while (!cts.IsCancellationRequested)
            {
                try
                {
                    // Read a line of input until a newline is encountered
                    var line = await reader.ReadLineAsync();

                    if (string.IsNullOrEmpty(line))
                    {
                        // If there's no input data, we will signal that 
                        // we will no longer send data on this connection
                        // and then break out of the processing loop.
                        await relayConnection.ShutdownAsync(cts.Token);
                        break;
                    }

                    // Output the line on the console
                    Console.WriteLine(line);

                    // Write the line back to the client, prepending "Echo:"
                    await writer.WriteLineAsync($"Echo: {line}");
                }
                catch (IOException)
                {
                    // Catch an IO exception that is likely caused because
                    // the client disconnected.
                    Console.WriteLine("Client closed connection");
                    break;
                }
            }

            Console.WriteLine("End session");

            // Closing the connection
            await relayConnection.CloseAsync(cts.Token);
        }



        // GET api/values/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/values
        public void Post([FromBody]string value)
        {
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        public void Delete(int id)
        {
        }
    }
}

Routing Messages from Azure Event Hub to Azure Service Bus

$
0
0
Is it possible to automatically route/redirect events from Azure Event Hub to Azure Service Bus

enter image description here

Basically i want to have a system-wide (used by the entire company) event hub and a service bus for a specific system (System X) (which is composed of multiple services)

Instead of developing a service that would read from Azure Event Hub and write to Azure Service Bus (System X Event Gateway), i would like to know whether there is a way to configure something like this in Azure.

I know that it is somewhat possible with Azure Logic Apps, but i doubt its performance, i need the messages to be routed immediately and in Logic Apps the default interval is 3 minutes. I also don't know whether it is the best way to do it, there might be another Azure product that i'm unaware of.

What do you suggest?

Azure relay hybrid connection listener not reestablishing when internet is disrupted

$
0
0

I have CUSTOM azure hybrid connection listener service running on premise with below mention code as MSDN suggested, but listener not getting reestablished when on premise INTERNET connectivity get disrupted.

Only 1 out of 10 times, listener getting reestablished with below code, when on premise INTERNET is disrupted

    // Opening the listener establishes the control channel to  
    // the Azure Relay service. The control channel is continuously   
    // maintained, and is reestablished when connectivity is disrupted       
    await listener.OpenAsync(cts.Token);

    //Below delegate not getting called when INTERNET plugged off from 
    //listener running machine
    listener.Offline += listener_Offline;

What changes required to reestablish listener to azure hybrid connection 10 out of 10 times?. Please advice.

Getting a "Microsoft.Azure.ServiceBus.ServiceBusCommunicationException" when writing a simple test

$
0
0

Hello,

I am trying to reproduce the simple example explained here about the use of Service Bus: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues

However, I am getting the following exception

Exception thrown: 'Microsoft.Azure.ServiceBus.ServiceBusCommunicationException' in System.Private.CoreLib.dll

with the message:

Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ErrorCode: TimedOut
 Stack Trace:    at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList`1 messageList) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\Core\MessageSender.cs:line 562
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\RetryPolicy.cs:line 85
   at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\RetryPolicy.cs:line 107
   at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\Core\MessageSender.cs:line 252
   at ServiceBusHelloWorld.Program.SendMessagesAsync(Int32 numberOfMessagesToSend) in C:\_dev\ServiceBusHelloWorld\ServiceBusHelloWorld\ServiceBusHelloWorld\Program.cs:line 58

in this line (SendMessagesAsync() method):

// Send the message to the queue
await queueClient.SendAsync(message);


Could it be an non-open ports issue? If so, what port should be used to handle the ServiceBus' response?

Azure Service Bus to Event Grid integration

$
0
0

Hi All, 

Having started to investigate the use of event grid with service bus I am trying to determine if both are required when Topics are used or just Event Grid. I use an Event Grid topic currently with a logic app as an event handler. In testing how Service Bus will be configured as an event producer I have the ability to create a Service Bus topic. Can a service bus topic push publish to a Event Grid topic or am I way off. If it can what is the use case?

Thanks


When using AMQP, is it encrypted?

$
0
0

Hi, I have a question about service bus.

I am creating IoT system with service bus and a pub-sub application with Azure SDK.

A pub-sub application publishes or subscribes data to/from service bus.

The protocol between a pub-sub application and service bus is AMQP.

When I use https, it is possible to encrypt data to protect data against unauthorized access computers with malicious intentions.

However, is it possible to encrypt data with SDK?

Usually, we send data to service bus with SDK methods like below, but does SDK automatically encrypt data?

https://docs.microsoft.com/ja-jp/azure/service-bus-messaging/service-bus-java-how-to-use-topics-subscriptions#send-messages-to-a-topic

Does SAS token is generated inside of SDK?

$
0
0

Hi,

I am creating an application which communicate with service bus in java language.

Usually, SAS token generation is required to access to service bus.

If I don't create token by myself, does SDK create SAS token once I send publish/subscribe requests?

My code is like this.

I am using sample java code from website, but it never uses methods to create a token.

publicvoidrun()throws Exception {// Create a QueueClient instance and then asynchronously send messages.// Close the sender once the send operation is complete. QueueClient sendClient = new QueueClient(new ConnectionStringBuilder(ConnectionString, QueueName), ReceiveMode.PEEKLOCK); this.sendMessageAsync(sendClient).thenRunAsync(() -> sendClient.closeAsync()); sendClient.close(); } CompletableFuture<Void>sendMessagesAsync(QueueClient sendClient){ List<HashMap<String, String>> data = GSON.fromJson( "["+ "{'name' = 'Einstein', 'firstName' = 'Albert'},"+"{'name' = 'Heisenberg', 'firstName' = 'Werner'},"+"{'name' = 'Curie', 'firstName' = 'Marie'},"+"{'name' = 'Hawking', 'firstName' = 'Steven'},"+"{'name' = 'Newton', 'firstName' = 'Isaac'},"+"{'name' = 'Bohr', 'firstName' = 'Niels'},"+"{'name' = 'Faraday', 'firstName' = 'Michael'},"+"{'name' = 'Galilei', 'firstName' = 'Galileo'},"+"{'name' = 'Kepler', 'firstName' = 'Johannes'},"+"{'name' = 'Kopernikus', 'firstName' = 'Nikolaus'}"+"]",new TypeToken<List<HashMap<String, String>>>() {}.getType()); List<CompletableFuture> tasks =new ArrayList<>(); for (int i = 0; i < data.size(); i++) { final String messageId = Integer.toString(i); Message message = new Message(GSON.toJson(data.get(i), Map.class).getBytes(UTF_8)); message.setContentType("application/json"); message.setLabel("Scientist"); message.setMessageId(messageId); message.setTimeToLive(Duration.ofMinutes(2)); System.out.printf("\nMessage sending: Id = %s", message.getMessageId()); tasks.add( sendClient.sendAsync(message).thenRunAsync(() -> { System.out.printf("\n\tMessage acknowledged: Id = %s", message.getMessageId()); })); } return CompletableFuture.allOf(tasks.toArray(new CompletableFuture<?>[tasks.size()])); }

Getting an exception: Message handler encountered an exception Microsoft.Azure.ServiceBus.MessageLockLostException: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. while removing message.

$
0
0

HI ,

I am getting below error while removing message from Queue.

Message handler encountered an exception Microsoft.Azure.ServiceBus.MessageLockLostException: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue.

I am receiving message then performing log running task then I am trying to delete/remove message from queue.

here is code that I have used.

 private async Task ProcessAgentServiceQueueMessagesAsync(Message message, CancellationToken token)
        {
            try
            {

                    //Create a CTS to launch a task in charge of renewing the message lock                     

                    var messageRenewCancellationTokenSource = new CancellationTokenSource();

                    var brokeredMessageRenew = Task.Factory.StartNew(() =>
                    {
                        while (!messageRenewCancellationTokenSource.Token.IsCancellationRequested)
                        {
                            //Based on LockedUntilUtc property to determine if the lock expires soon
                            if (DateTime.UtcNow > message.SystemProperties.LockedUntilUtc.AddSeconds(-10))
                            {
                                // If so, we repeat the message
                                messageReceiver.RenewLockAsync(message.SystemProperties.LockToken);
                            }

                            Thread.Sleep(500);
                        }
                    }, messageRenewCancellationTokenSource.Token);
                    await Task.Run(() => LongRunningfunction());
                   await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

         }

          catch(Exception ex)

         {

         }

        finally

       {

               messageRenewCancellationTokenSource.Cancel();

       }

}

Please let me know, what is wrong in this code. I am renewing lock before token get expire still I am getting exception and message is remaining in queue.

Using Service Bus to both send and receive messages

$
0
0

Hi all,

I would like to know if it is possible to use Azure Service Bus inside an app that both sends and receives messages from and to topics.

The issue here is that this application should be listening on a subscription and,in parallel, send messages to other topics.

Furthermore, sending messages to other topics depends on the messages received in the subscription the app is listening on. For example: if I receive the message "A" on the subscription, I want to send a message to topic "A", but if I receive the message "B", I want to send a message to topic "B". The listening should not stop after sending messages, as new messages may arrive.

Is it possible to address this task using Service Bus? 

Thank you in advance.

Event Hub/Service bus publishing publically

$
0
0

Hi,

I know you can secure end to end messages in EH with SAS Tokens however is it suitable to expose Event Hubs publically without adding Layer 7 based security layers or Firewalls etc?

This is for a B2B type scenario.

Same question as well for Service Bus, i read it can also use API Management but i'd rather not add more cost/complexity if feasible.


Get messages from a topic subscription only brings one message

$
0
0
I'm testing the Azure Service Bus. so, I created a Topic and a subscription for the topic. Seems that everything is working as it should when inserting messages to the Topic. Things are also OK when I receive the messages only via code
however, when I try and receive messages from a topic subscription using the "get messages from a topic subscription" Logic App step, it only receives one message at a time. I know I have 8 messages in the topic and the LA automatically sets Foreach to get all the messages. However, it only receives one.

On premise Service Bus to Azure Service Bus - How to determine current number of brokered connections, message size, etc.

$
0
0

In the process of migrating from Microsoft on-premise Service Bus to Azure Service Bus and unsure how to calculate/compare our current usage with Azure's pricing tiers (will 'Standard' be sufficient or do we need 'Premium'?).

How do I measure (average, max, etc) our current on-prem 'brokered connections' and message size?

Thanks for any info,


Facing issue with sending message from cloud to device iot hub via rabbitmq(amqp protocol)

$
0
0
//send.php<?php
        require_once __DIR__ .'/vendor/autoload.php';usePhpAmqpLib\Connection\AMQPStreamConnection;usePhpAmqpLib\Message\AMQPMessage;

    $connection =newAMQPStreamConnection('HUBNAME.azure-devices.net',5671,'HUBNAME.azure-devices.net/DEVICENAME/?api-version=2018-06-30','SharedAccessSignature sr=HUBNAME.azure-devices.net&sig=XXXX&se=XXXX&skn=iothubowner');

    $channel = $connection->channel();
    $channel->queue_declare('hello',false,false,false,false);
    $json ='{"id":123, "value":"xyz"}';
    $msg =newAMQPMessage($json);
    $channel->basic_publish($msg,'','hello');
    echo " [x] Sent 'Hello World!'\n";
    $channel->close();
    $connection->close();

when i run this send.php file i am getting error:
fatal error: Uncaught PhpAmqpLib\Exception\AMQPConnectionClosedException: Broken pipe or closed connection in C:\xampp\htdocs\amqp\vendor\php-amqplib\php-amqplib\PhpAmqpLib\Wire\IO\StreamIO.php:222

Hybrid Connection Manager UI Setup

$
0
0

Hi,

I logged the following with @AzureSupport Twitter:

"I have just downloaded the hybrid connection manager ui. I am stuck in an endless loop of 'Configure another Hybrid Connection' > log in > Nothing is listed > 'Configure another Hybrid Connection' > repeat ... I have tried on Windows 10 and Windows Server 2016. All I want to do is set up a hybrid connection relay"

The conclusion the agent came to was that Server 2016 is not supported but this doesn't sound right to me. Could I be missing some pre-requisites on the server?

Thanks in advance

Alex

MS-SQL server on premise connection from azure

$
0
0
Does anyone know how to make this work?

Sharepoint Workflow Configuration Error While joining an existing farm

$
0
0

Hi,

I have faced an error while joining an existing workflow farm. I have installed the Workflow Manager 1.0 Refresh (CU2) and the service bus 1.1 (KB2972621) was uploaded with CU2. 

When I tried to join the existing farm, it gave me the following error. How can I sort out this issue?

[Error] [3/11/2019 1:47:50 PM]: System.Management.Automation.CmdletInvocationException: The given key was not present in the dictionary. ---> 
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Microsoft.ServiceBus.Commands.AddSBHost.ValidatePorts()
   at Microsoft.ServiceBus.Commands.AddSBHost.ProcessRecordImplementation()
   at Microsoft.ServiceBus.Commands.ServiceBusBaseCmdlet.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
   at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
   at Microsoft.Workflow.Deployment.ConfigWizard.CommandletHelper.InvokePowershell(Command command, Action`3 updateProgress)
   at Microsoft.Workflow.Deployment.ConfigWizard.ProgressPageViewModel.AddSBNode(FarmCreationModel model, Boolean isFirstCommand)

REST API - some issues sending/reading messages to/from topic

$
0
0

Hi,

I'm using Postman trying sending/reading messages to/from a Service Bus topic.

When sending a message I get a 201 response (obviously the message was sent successfully); however on the Azure Portal I don't see the message coming in.

This is the request for Sending a message

POST /in/xyz/messages HTTP/1.1
Host: xxx.servicebus.windows.net
Authorization: SharedAccessSignature sr=https%3a%2f%2fxxx.servicebus.windows.net%2fin%2fxyz&sig=<signature>skn=PublisherAccessKey
Content-Type: application/atom+xml;type=entry;charset=utf-8
Cache-Control: no-cache
Postman-Token: 0367c33a-bfdb-87cf-29ba-ef49d2d8eaa4

id=100

I get a 201 but also ERROR: Could not parse the response.

This is the request for Reading messages

DELETE /in/xyz/messages/head HTTP/1.1
Host: xxx.servicebus.windows.net
Authorization: SharedAccessSignature sr=https%3a%2f%2fxxx.servicebus.windows.net%2fin%2fxyz&sig=<signature>se=65023492524&skn=SubscriberAccessKey
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: 3cba05df-9087-059f-0c15-f0924e0ea033

The error message I get here:

<Error><Code>400</Code><Detail>The specified HTTP verb (DELETE) is not valid. TrackingId:e485acb6-fd6b-44a4-a1c3-bebea910b0fe_G43,TimeStamp:4/4/2015 5:58:17 PM</Detail></Error>

Anyone any idea what I'm doing wrong?

Thanks.
Guy

Viewing all 1916 articles
Browse latest View live