Note that there are some explanatory texts on larger screens.

plurals
  1. POFiltering Subscriptions to Windows Azure Service Bus Topics using Java
    primarykey
    data
    text
    <p>I would like to use Windows Azure Service Bus Topics with subscription filters in my Java application. I am using the <a href="http://msdn.microsoft.com/en-us/library/hh690946.aspx" rel="nofollow">Windows Azure Plugin for Eclipse with Java (by Microsoft Open Technologies)</a> and the Windows Azure SDK 2.0.</p> <p>I found that the <a href="http://www.windowsazure.com/en-us/develop/java/how-to-guides/service-bus-topics/" rel="nofollow">basic example code</a> on the Microsoft website showing how to do this with the Java API is not working. </p> <p>How should the basic example code accomplish the following programmatically from a Java application using the API?</p> <p>1) Get a ServiceBusContract object for an existing “TestTopic” in my existing namespace.</p> <p>2) Create an “AllMessages” subscription using the default MatchAll filter. This subscription receives all the messages sent to “TestTopic” in it’s virtual queue.</p> <p>3) Create a “LowMessages” subscription using a SqlFilter filter to filter for “MessageNumber &lt;=3”. The virtual queue for this subscription should only receive messages having a MessageNumber custom property value less than or equal to 3 .</p> <p>4) Create a “HighMessages” subscription using a SqlFilter to filter for “MessageNumber &lt;=3”. The virtual queue for this subscription should only receive messages having a MessageNumber custom property value greater than 3.</p> <p>5) Send a batch of example brokered messages to “TestTopic” with ( 0&lt;= MessageNumber &lt;7)</p> <p>6) Receive the messages for all three subscriptions and show they have been filtered.</p> <p>I believe I found reasons the example was not working, and I include the corrected Java code as an answer below for others that may also want to see a basic example of how to do this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload