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

SubscriptionClient.Receive With Pause

$
0
0

I have a customer who wants to constantly run a subscription that receives messages in a topic.  This I have coded for.  Now, the client wants to ability to "pause" the receive process.  Would this be the equivalent of defer?  Or is there a safe way to do this without losing messages or a recommended pattern?

Thanks

 

Please Vote &/or "Mark As Answer" if this post is helpful to you. Thanks and happy coding :D


How to use the property BrokeredMessage.To

$
0
0

What is the purpose with the property BrokeredMessage.To and how shall it be used?

Normally when creating a MessageSender you have to provide the destination (the address) where
the sender will put the messages sent. But, can that be overriden by setting the To property on
the BrokeredMessage?

My usecase is that I really want to create a generic MessageSender which is not allocated to a certian
destination. I like to provide the destination when sending the message.
(Compare MessageProducer() in JMS).

BrokeredMessage.CompleteAsync always gives ObjectDisposedException

$
0
0

message.CompleteAsync().ContinueWith(tr =>
                    {
                        if (tr.Exception != null)
                        {                       
                            Trace.TraceWarning("Failed to Complete BrokeredMessage \n" + tr.Exception.ToString());
                        }
                    });

--------------------------------------

Failed to Complete BrokeredMessage 
System.AggregateException: One or more errors occurred. ---> System.ObjectDisposedException: BrokeredMessage has been disposed.
   at Microsoft.ServiceBus.Messaging.BrokeredMessage.ThrowIfDisposed()
   at Microsoft.ServiceBus.Messaging.BrokeredMessage.EndComplete(IAsyncResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ObjectDisposedException: BrokeredMessage has been disposed.
   at Microsoft.ServiceBus.Messaging.BrokeredMessage.ThrowIfDisposed()
   at Microsoft.ServiceBus.Messaging.BrokeredMessage.EndComplete(IAsyncResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)<---

Add-SBHost : Throws error : to change the port of ClusterConnectionEndpoint

$
0
0

How to change the port of ClusterConnectionEndpoint 

Add-SBHost : The port number 9000 that was chosen for ClusterConnectionEndpoint (either explicitly by the user or implicitly as a default) clashes with another port. Please change to another value.
At line:1 char:1

Azure Event hub and Consumer group

$
0
0

Hi,

I have created one event hub and multiple consumer group for same event hub.

When I have send data trough event hub all consumer group received same data,So How should I will create filter for  send message to  specific consumer group

Certificate requested with thumbprint xxx not found in the certificate store. Certificate was deleted as it had expired.

$
0
0

The certificate for the server hosing the Service Bus expired two days ago and did not auto renew. This is because we changed to a new CA last year and decommissioned the old CA. As a result of this then the service bus services had stopped and would not start. 

I manually renewed the SSL certificate for the server and deleted the old certificate (deleting was a mistake)

If I now try to use powershell to change the certificate (Set-SBCertificate) or use any other commands I get the error message:

Certificate requested with thumbprint
F78F8E609D8E552636449031410177B066364D5B not found in the certificate store. 

I guess the thumbprint is for the old certificate which I deleted.

I there any way to recover from this?

If I manage to restore the deleted certificate, can this issue be resolved? 

thank you.

ACS OAuth2 tokens

$
0
0

Hi,

I have created Service Bus with ACS, attached WCF relay service and everything work great.
Now I would like to use OAuth2 with my relay service.

In first step I sent POST to get token from :
https://mynamespace.accesscontrol.windows.net/v2/OAuth2-13

with success

{
  "token_type": "http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0", 
   "access_token": "net.windows.servicebus.action=Listen......", 
   "expires_in": "10800", 
   "scope": "http://{mynamespace}.servicebus.windows.net/"
}
Now
I need some example how to set headers with this token.
When I set headers with something like this

Authorization: Bearer "net.windows.servicebus.action=Listen..."

I have
"Invalid authorization header: The request is missing WRAP authorization credentials"

Why WRAP? I would like to use OAuth2 not OAuth WRAP

Using OAuth 2.0 with Service Bus

$
0
0


 I would like to use OAuth2 with my relay service.

 Post to get the token:
https://mynamespace.accesscontrol.windows.net/v2/OAuth2-13

with success

{
  "token_type": "http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0", 
   "access_token": "net.windows.servicebus.action=Listen......", 
   "expires_in": "10800", 
   "scope": "http://{mynamespace}.servicebus.windows.net/"
}
 

This header does not work still

Authorization: Bearer "net.windows.servicebus.action=Listen..."

I have
"Invalid authorization header: The request is missing WRAP authorization credentials"

 I would like to use OAuth2 not OAuth WRAP


Receiving Message Multiple times for a client and Message Deletes after one client received

$
0
0

Hi All,

I have two clients listening to a subscription of topic .  I am seeing following issues.

Issue 1:

If one client receives a message and marks them completes other client won't receive that messages.

But i want all my clients to receive that message and acknowledge it so that once a client receives the message it shouldn't receive again

Issue 2:

If i don't acknowledge the message as complete . Some times i am receiving the message multiple times.

Issue 3:

During the Message Receive if see the Network disconnect. After some time it reconnects  I am receiving the messages from starting again.

For Sending the Message Code

============

if (!namespaceManager.TopicExists("DataCollectionTopic"))
                    namespaceManager.CreateTopic("DataCollectionTopic");
            if (!namespaceManager.SubscriptionExists("DataCollectionTopic", "one"))
                namespaceManager.CreateSubscription("DataCollectionTopic", "one");
            for(int i=0;i<100;i++)
            {
            BrokeredMessage bm = new BrokeredMessage("new Topic one");
            bm.Label = "hELLLOOOO xcvxvxcvxvxvxc DummyMEssage"+i;
            bm.Properties["StoreName"] = "asdasdasqwedas";
            bm.Properties["MachineID"] = "Bajjiiiqweq567567wii";

            if (namespaceManager == null)
            {
                Console.WriteLine("\nUnexpected Error");
                return;
            }
            MessageSender sender = messageFactory.CreateMessageSender("DataCollectionTopic");
            sender.Send(bm);

for receiving the message

===================

                                   

MessageReceiver receiver = await messageFactory.CreateMessageReceiverAsync("DataCollectionTopic/subscriptions/Vijay");

                while (true) { 

                 BrokeredMessage receivedMessage = receiver.Receive();

                try
                {
                  ProcessMessage(receivedMessage);
                 //  receivedMessage.Complete();
                }

                catch (Exception e)
                {
                    //  receivedMessage.Abandon();
                }
                }
            }

===============

TIA

Not able to listen on Azure EventHostProcessor

$
0
0

Hi Team,

Struggling with an issue regarding Azure EventHostProcessor.

Event Processor unable to create partitions when the account connection string is given(accountname and accountkey)as 

1. Without encoding taken key from my storage account and given as below

String storageConnectionString =

"DefaultEndpointsProtocol=https;AccountName=<azure_storage_account_name>;AccountKey=<account_key>"

Here the key contains '/' character

I am getting the error as

 java.security.InvalidKeyException: Storage Key is not a valid base64 encoded string. Storage Key is not a valid base64 encoded string.
java.security.InvalidKeyException: Storage Key is not a valid base64 encoded string.

2. And so I encoded the string to base64 and given as 

String storageConnectionString =

"DefaultEndpointsProtocol=https;AccountName=<azure_storage_account_name>;AccountKey=".concat(Base64.getEncoder().encodeToString(<account_key>).getBytes()));

But now the error I am getting is 

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.(403 - Access denied)

The branch code that I have taken from for ephprocessor is 'https://github.com/Azure/azure-event-hubs/tree/master/java/azure-eventhubs-eph'

Not but the least my actual task is to send the device messages on to service bus which I have to do on EventProcessor class 'onEvent' method.But was stuck with the above errors.

Please do needed support on this or pls guide me for appropriate contact.





Max retry count not working in retryexponential class

$
0
0

            ServiceBusConnectionStringBuilder connBuilder = new ServiceBusConnectionStringBuilder();
            connBuilder.ManagementPort = HttpPort;
            connBuilder.RuntimePort = TcpPort;
            connBuilder.Endpoints.Add(new UriBuilder() { Scheme = "sb", Host = ServerFQDN, Path = ServiceNamespace }.Uri);
            connBuilder.StsEndpoints.Add(new UriBuilder() { Scheme = "https", Host = ServerFQDN, Port = HttpPort, Path = ServiceNamespace }.Uri);
            MessagingFactory messageFactory = MessagingFactory.CreateFromConnectionString(connBuilder.ToString());
            NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connBuilder.ToString());
            messageFactory.RetryPolicy =
           new RetryExponential(
               minBackoff: TimeSpan.FromSeconds(0),
               maxBackoff: TimeSpan.FromSeconds(30),
                 deltaBackoff: TimeSpan.FromSeconds(3), terminationTimeBuffer: TimeSpan.FromSeconds(3),
               maxRetryCount: 3);
            namespaceManager.CreateSubscription("NewTopic", subscriberId);
            namespaceManager.Settings.RetryPolicy =
               new RetryExponential(
                   minBackoff: TimeSpan.FromSeconds(0),
                   maxBackoff: TimeSpan.FromSeconds(30),
                     deltaBackoff: TimeSpan.FromSeconds(3), terminationTimeBuffer: TimeSpan.FromSeconds(3),
                   maxRetryCount: 3);
            SubscriptionClient receiver = messageFactory.CreateSubscriptionClient("NewTopic", subscriberId);

            try
            {
                OnMessageOptions options = new OnMessageOptions();
                options.AutoComplete = false; 
                options.ExceptionReceived += options_ExceptionReceived;
                receiver.RetryPolicy =
new RetryExponential(
   minBackoff: TimeSpan.FromSeconds(0),
   maxBackoff: TimeSpan.FromSeconds(30),
     deltaBackoff: TimeSpan.FromSeconds(3), terminationTimeBuffer: TimeSpan.FromSeconds(3),
   maxRetryCount: 3);
                receiver.OnMessage(receivedMessage =>
                {
                    try
                    {

                        Console.WriteLine(receivedMessage.Label);

                        bool t = receivedMessage.IsBodyConsumed;
                        Console.WriteLine(string.Format("Message received: {0}", receivedMessage.GetBody<string>()));
                        Console.WriteLine(receivedMessage.SequenceNumber);
                        Console.WriteLine(receivedMessage.TimeToLive);
                        Console.WriteLine(receivedMessage.To);

                        Console.WriteLine(receivedMessage.DeliveryCount);



                        receivedMessage.Abandon();
                    }
                    catch (Exception)
                    {
                        // Indicates a problem, unlock message in subscription.
                        receivedMessage.Abandon();
                    }
                }, options);

I am Abandoning the message after i receive and i set maxRetryCountas 3. But it's delivering the message 10 times

                          

Can't uninstall service bus

$
0
0

Hi,

When trying to uninstall Service Bus i get this error:

"This computer is part of a farm. To uninstall, first leave the farm either using 'Leave from Farm' option in Service Bus Configuration tool or Remove-SBHost cmd-let in PowerShell."

When trying the Remove-SBHost powershell command I get this error:

"Remove-SBHost : Certificate requested with thumbprint EC808B911009F8A8E21FE73DE5216E6B596527F4 not found in the certificate store LocalMachine\My."

When trying to open the configuration tool it just craches with this information in the eventlog:

Application: Microsoft.ServiceBus.ConfigWizard.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException

How can I uninstall the Service Bus?


TR

ServiceBus RBAC control

$
0
0

I believe the service bus has been fully ported to RM.

However,  we have users who are assigned to the contributor role scoped to the subscription.

Their contributor role permissions are properly inherited to new resource groups. 

However, neither the contributor role at subscription nor the contributor scoped at any resource groups has the service bus provider listed in the RBAC role permission set.

When a user who is a contributor at both subscription and resource group tries to create a service bus they get the following error:

"You don't have the required permission (Microsoft.ServiceBus/register/action)"

I attempted to resolve this with the following cmds:

$role = Get-AzureRmRoleDefinition "Contributor"
$role.AssignableScopes.Add("/subscriptions/<MYSUBSCRIPTONGUID>")
$role.Actions.Add("Microsoft.ServiceBus/*")
Set-AzureRmRoleDefinition -Role $role

This fails because I am not authorized even though I am a Subscription Admin (ie coadmin).

We wish to manage permission to the service bus the same way we manage access to all ARM resources.

Please adivse why read\write access is not assigned to the servicebus provider on the contributror RBAC role.

Thanks!!

Does REST Send Message Batch complete atomicly?

$
0
0

Hi;

I want to send two messages to one service bus queue or topic at once. I have to be sure that both messages are saved by the service bus.

I know, I could use .Net library and Transaction Scope. But I use .Net Core and there is NO developed library for it.

Does the method explained at https://msdn.microsoft.com/en-us/library/dn798894.aspx complete transactional for all the messages send in the request?


Azure Service Bus: What is a request and a message?

$
0
0

Hi,

    Our Application is using Azure service bus for messaging purpose. We created few topics and subscribers. Actually we will send around 500 messages per day. But in the graph it shows lakhs of Requests for 500 messages. Our billing price is Also coming around 800$ per month. This is too much for 500 * 30 messages. I am not able to understand why the price is this much and also i want to know what does the requests in the graph mean?.

If the reason for the price is because of more number of requests then how can i reduce the number of requests?. Messages i am seeing correctly. The problem is only with requests.

This is Just a sample Graph for your reference(Not original). In original graph i am seeing around lakhs of requests for 500 messages.  

image url:

http://i.stack.imgur.com/ZZveV.png

 Please help me in understanding the price.......



unable to export activity log to service bus

$
0
0

Hello,

when use azure, i encountered a stange issue. i keep getting a Forbidden error when tried to export my activity log to service bus. 

and i can not upload my screenshot. page said "

  • Body text cannot contain images or links until we are able to verify your account.

"

Getting handleListenerSetupFailure

$
0
0

Hi Team,

I am connecting to queue on azure service bus using jmsConnectionFactory in Spring.

Creating connectionFactory as follows :

jmsConnectionFactory.setUsername(<username>);

jmsConnectionFactory.setPassword(<password>);
jmsConnectionFactory.setRemoteURI("amqps://<servicebusName>.servicebus.windows.net?amqp.idleTimeout=120000");

Configuring defaultMessageListener :

@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setConcurrency("1-1");
return factory;
}

And have written receiver as

     

@Component
public class MessageReceiver {

private static final String ORDER_RESPONSE_QUEUE = "deviceque1";
    @Autowired
    MessagingService messagingService;

    @JmsListener(destination = ORDER_RESPONSE_QUEUE)
    public void receiveMessage(final Message message) throws JMSException {.processing messages.}

}

And I am using apache qpid maven dependencies, EventProcessor for eventhubs where in the onEvents() listener method sending messages to the que

I am getting the error as 

Setup of JMS message listener invoker failed for destination 'deviceque1' - trying to recover. Cause: Remote did not respond to a drain request in time

Can you please help in sorting out this issue

Thanks in Advance





How to Switch to different nodes if one of the nodes is down?

$
0
0
I have a farm to which two nodes are added. My Server sends messages to one node and client connected to same node to receive messages. What if that node goes down? Is there any fall back mechanism such that my server and client switch to other nodes avalibale and starts sending and receiving messages respectively

How to set TimeToLIve explicaity before send message to deadletter

$
0
0

Hi,

I'm trying to update TimetoLive for a brokered message before sending it to Deadletter as below but the message when moved to deadletter it is taking the time to live value when it is created. It is not taking the value which I set before moving to dead letter.

 message.TimeToLive = new TimeSpan(0, 5, 0);
 await message.DeadLetterAsync();
Is there something I'm missing here? I wanted to update TTL before sending message to dead letter. Does deal letter always take TimeToLive value from the message?

Thanks, Amar


Adding node a farm giving error

$
0
0

Starting
Validating input and configuration parameters.
Installing auto-generated certificate.
Unable to obtain private key file name for certificate with thumbprint:XXXXXXXXXXXXXXXXXXXXXXXXXXX.

I am able to access the folder C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

Even though i am seeing the error.

 Is there any other way i can access that certificate while adding a node to farm.

Viewing all 1916 articles
Browse latest View live