Utilizzando l'SDK di Azure di giugno 2012, ho un argomento sul bus di servizio e sto aggiungendo un abbonamento.Come filtrare una sottoscrizione all'argomento ServiceBus in base a una proprietà incorporata della classe BrokeredMessage?
Voglio filtrare quell'abbonamento. Se faccio questo in base a uno degli elementi che ho aggiunto alla borsa BrokeredMessage Proprietà, quindi questo funziona bene:
// Send the message:
BrokeredMessage message = new BrokeredMessage(serializableObject);
message.Properties.Add("MySessionId", "GUID");
getTopicClient("MY_TOPIC").Send(message); // method creates client. omitted here.
// Retrieve it:
SqlFilter myFilter = new SqlFilter(@"(MySessionId = ""GUID"")");
namespaceManager.CreateSubscription("MY_TOPIC", "MY_SUB", myFilter);
SubscriptionClient client = getSubscriptionClient("MY_TOPIC", "MY_SUB"); // method creates client. omitted here.
// This will work fine:
Message newMessage = client.Receive();
Se, invece, faccio lo stesso, ma aggiungere il valore di filtro a una delle proprietà diretta dell'oggetto BrokeredMessage, come SessionId, allora questo non riesce:
// Send the message:
BrokeredMessage message = new BrokeredMessage(serializableObject);
message.SessionId = "GUID";
getTopicClient("MY_TOPIC").Send(message); // method creates client. omitted here.
// Retrieve it:
SqlFilter myFilter = new SqlFilter(@"(SessionId = ""GUID"")");
namespaceManager.CreateSubscription("MY_TOPIC", "MY_SUB", myFilter);
SubscriptionClient client = getSubscriptionClient("MY_TOPIC", "MY_SUB"); // method creates client. omitted here.
// This will never receive a message
Message newMessage = client.Receive();
Come posso costruire uno SqlFilter che affronterà il built-in proprietà dell'oggetto BrokeredMessage (sessionid, o ReplyToSessionId, o MessageId
?È anche possibile?
Esattamente quello che stavo cercando. Grazie molto! – JcFx