Skip to main content

Posts

Showing posts from September, 2012

Patterns in Windows Azure Service Bus - Resequencer Pattern

Today we will talk about another message pattern: Resequencer. In the last post I presented Recipient List Pattern . In comparison with this pattern, Resequencer Pattern is very different. The main scope of this pattern is to help us to put messages back in a specific order. When we are talking about messages, we can talk about a stream of messages that need to be received in a specific order. It is very crucial for the receiver to retrieve the messages in the same order he receives. Theoretically, in a simple case we will receive messages in the expected order. This is offer Service Bus by default. But what happen if an error occurs on the receiver and message is putted back in the queue. We will need to retry to consume that message one more time and not the next message. Another case when the order can be broken is when we have more than one producer. For this case we can have two different situations. In the first scenario, each producer will produce messages for different stre...

Patterns in Windows Azure Service Bus - Recipient List Pattern

I will continue the blog series of post about patterns that can be user with Service Bus of Windows Azure with Recipient List Pattern. Did you ever try to send an email to a list of users? Using Exchange Server is quite simple. We can create a group list and send an email to the specific group list. For example we can have groups of email for different products categories. One can be for TVs, another one for Notebooks and so on. If we create a complex system for a company that have different products that want to send we will need to be able to send notifications about new products that are available. To be able to do something like this we will need a system that permits us to send notifications to a “group” – to a list of subscribers. In a system that is based on messages we will not know the list of subscribers for each group. Because of this we can decorate each message with some meta-information about the groups should receive the message. In Windows Azure, we can implement this ...

ListView - make selected item visible don't work in all cases

Did you ever try to use the ListView for Windows 8 Applications? If you had a more complicated scenario where you need to ensure that the selected item from your code is visible maybe you had the following problem… How can I make the selected item visible? If I have a lot of items in my scroll list than the selected item will not be visible when we select it. listView.set(i).done(); In this way we select the ‘i’ element of the list. Also the set() method unselect the rest of the items that were selected already. To be able to show it in the visible part of the list we need to call the ensureVisible() method after we set it. listView.set(i).done(); listView.ensureVisible(i); But in more complicated cased you will notify that this will not work. Even if the ensureVisible() method is called nothing will happen. Usually this case appears when the method is called in a “callback” or in a complete, error or progress of a promise. Even if you try o the ensureVisible in a msSetImmediate it w...

Patterns in Windows Azure Service Bus - Message Aggregator Pattern

In the last post I talked about Message Filter Pattern that can be used on Windows Azure Service Bus. Today I will describe how we can use Message Aggregator Pattern. From some points of view, this pattern is the opposite pattern in comparison with Message Splitter Pattern . Do you remember when Message Splitter Pattern can be used?… when we want to split messages based on some rules. Message Splitter Pattern does the opposite thing. This pattern can be used when we want to aggregate different messages. This pattern can be used with success in cases when we send some information in more messages. For example if send GPS position of cars based on the type. Until the car will reach the destination it will send a lot of messages. We will need to mark with a custom property the last message that is send by the cars of a given type – or to define a timeout period. When the last message will be received we will be able to process the data – for example to calculate the total distance and t...

Patterns in Windows Azure Service Bus - Message Filter Pattern

In the last post I tacked about Splitter Pattern .Today we will continue with Message Filter Pattern. This pattern can be used with success with Windows Azure Service Bus. As the name says, all the messages are filtered based on specific rules. Any message that will reach the consumer will be filter based on this rules. All the producers will use the same entry point where they will add messages. They don’t have to know that messages are filtered based on same rules. In this way, the message system will create a decoupling between the producer and the consumer. This pattern is used to be able to control the messages that where not routed to any subscriber. Windows Azure Service Bus Topics can be used for this purpose. It gives us the ability to define rules that can check the messages content based on meta-information. These rules will be added to each subscriber and will specify if the messages will be accepted or not. SqlFilter myCustomFilter = new SqlFilter("grade...

Patterns in Windows Azure Service Bus - Message Splitter Pattern

In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an application that can route messages for a house which is controlled remotely. Before we can talk about this we need to see some design patterns that can be used in combination with Service Bus. I will write a series of post about this. We will start with Splitter pattern. This pattern refers to the ability to have a collection of messages parts that form one message or an entity for us. This pattern gives as the ability to receive and process messages from the related messages separately. In this way all the messages that belong to that message part will be sent to the same consumer.   How we can use this pattern in Service Bus? Hmm, is pretty simple. We can use SessionId property of a message for this. In this way, when a client (consumer) start to receive a message with a given session id, we can specify to receive only messages with ...

Service Bus Topics - Define custom rules for messages that don’t respect any rule defined in a topic

In one of my older post I tacked about how we can define filters for each subscriber of a Service Bus Topics. We saw how we can filter messages for a subscriber based on some rules that are defined using FilterExpression: RuleDescription ruleDescription = new RuleDescription() { Action = new SqlRuleAction("set isValid= false"), Filter = new SqlFilter("value = 10"); } namespaceManager.CreateSubscription( "myFooTopic", "seccondSubscription", ruleDescription); var subscription = namespaceManager.CreateSubscription( "myFooTopic", " thirdSubscription"); subscription.Add(ruleDescription); Using these rules is quite simple to define custom rules for the messages from a topic. But what about messages that don’t respect any rules defined in our topic? How we can detect these messages and define a custom rule for them. In a perfect word we can control the messages that arrive in our topic, but ...

updateLayout method of WinJS.Page – what we should be aware of

If you already created a Windows 8 Application in HTML 5 and JavaScript maybe you already used a page control. Every page control has a Java Script file behind this, like in ASPX and WinForms. In this blog post I want to talk about some methods that we can define in this page control – especially one. If we create a page control from Visual Studio (Add New) you will observe that 3 defaults method are automatically added: ready unload load init processed render error updateLayout The “ready” method is called after all the controllers were loaded to the page and the DOM element was created. In this moment the element was already rendered to the screen. The “unload” method is used when we have some resources that we want to free (for example some binding). “updateLayout” method is called when the page layout is change. A case when this method is called by the system is when the layout is changed from landscape to portrait. What we should know about this method is what happens...

Service Bus Topics blog post series – a comprehensive look at Service Bus Queues from Windows Azure

In the last month I wrote a series of post about Service Bus Topics from Windows Azure. In this post I will summarize all the blog posts about Service Bus Topics that I wrote until now: Service Bus Topics - Overview - a short introduction about base concepts in Service Bus Topics Service Bus Topics - How to use it (part 1) - describe how we can add messages to topics. Service Bus Topics - How to use it (part 2)- describe how we can consume messages to topics. Service Bus Topics - Define custom rules for messages that don’t respect any rule defined in a topic Service Bus Topics - Limitations - describe what are the limitations of topics from Windows Azure Service Bus Topics - Using with WCF services - how we can use topics with WCF services Service Bus Topic - Different ways to create and manage it- different locations from where we can manage and control topics Service Bus Topic – How we can migrate from Service Bus Queue - how we should design our application to be able to m...

Windows 8 Dev Camp, Cluj-Napoca - September 29

A great Windows 8 Dev Camp will be organized in September 29 by Codecamp and ITSpark. This event is 100% free. We will have 6 great sessions. See you there! http://codecamp-cluj-sept2012.eventbrite.com/ ---------------------------------------------------------------------------------------------- Nu a mai rămas mult până la lansarea oficială a Windows 8. Cu această ocazie Codecamp împreună cu ITSpark vă invită la “Windows 8 Dev Camp ”. ÃŽn cadrul acestui eveniment o să disecăm o parte din secretele pe care un dezvoltator trebuie să le cunoască despre Windows 8. Participarea la eveniment este gratuită . MulÈ›umim în special sponsorilor pentru susÈ›inere. Agendă 9:15-9:30 Sosirea participanÈ›ilor 9:30-10:20 What's new in Windows 8? Tudor Damian A brief overview of the new features and performance improvements in Windows 8. 10:30-11:20 Integrating the Windows 8 Experience with Contracts Tiberiu Covaci Windows 8 introduces a new sys...