Skip to main content

Posts

Showing posts from August, 2012

Service Bus Topic – How we can migrate from Service Bus Queue

Yesterday we saw different methods that give us the ability to communicate with Service Bus Topics and all spin around the HTTP/S. Today we will reach a more sensible topic. How we can write a client and a server that at begging use Service Bus Queues and after a while be begin use Service Bus Topics. We want to achieve this with a minimal effort time. Also when the transition is done from queues to topics we want minimal changes in our code. I think that we already observed that this two services are very similar. The API are almost the same, not only this, but also the message that is send and received from the services has the same time, BrokeredMessages. Until now, on all examples we used QueueClient and TopicClient classes to communicate with queues and topics. This is very good; those are the basic classes that should be used for normal situation. But if we look in these two classes we will discover a powerful property named “InternalSender”. This class returns a “MessageSender”

Service Bus Topic - Different ways to create and manage it

In the last post , we saw how easily we can integrate Service Bus Topic with WCF. Today topic is simple. There are times when we need to create topics and subscriptions that are valid for one day or two. Not only this, this task can sometimes be done by various persons of applications. Let’s see what our options are. Of course the most powerful tool is the code. From code we can create topics, subscriptions and configure them in any way we want. When we create a topic we can set the default TTL value of messages that will be send to the topic, but we will not be able to set a property that specify the TTL of the topic (delete after 2 days for example). But, beside this we can set others values like the maximum size of the topic, enable or disable the batch operations and if the message duplication detection is activated. Similar configurations can be made to a subscription using SubscriptionDescription. TopicDescription topicDescription = new TopicDescription() { RequiresDuplicateDete

Service Bus Topics - Using with WCF services

If in my last post I talked a little about the limitations of Service Bus Topics, I think that this is the moment to see one of the greatest features of this service. Service Bus Topics has a lot in common with Service Bus Queues. In one of my posts I describe how we can integrate WCF with Service Bus Queues, but this can be done with Service Bus Topics as well. In a large system, we have a lot of services that communicate between them and there are cases when a WCF service do more than one thing because the endpoint of that WCF service is the entry point and this is the only way how we can ensure that a couple of actions are executed when the services is called by a specific client. Because of this is not very easy to add, remove some behaviors to an endpoint and also the load balancing in this case can be nightmare. Using WCF services exposed using Service Bus Topics can be our solution. Very easily a client can call a service that is only a façade to more than one service. Based on

Java Script code refactoring - hands on code

Let's see how we can create a mechanism that based on some flags; it will able to determine the status of some objects. The first version of code would look like this: ItemStatus = { Status1: "Status1", Status2: "Status2", Status3: "Status3" }(); ItemTypes = { Item1: "Item1", Item2: "Item2", Item3: "Item 3" }(); var ItemConfiguration = function () { function ItemConfiguration() { } ItemConfiguration.prototype = function () { getItemConfiguration: function (itemTypes, flag1, flag2, flag3, flag4) { switch (itemTypes) { case ItemTypes.Item1: if (flag1 && flag2) { return ItemStatus.Status1; } else if (flag3 || flag4) { return ItemStatus.Status2; } break; case ItemTypes.Item2: if (