Archive for the 'Tutorials' Category

JMS - Ensuring Reliability | Part - 2


Continuing from Part 1 which talked about Message Acknowledgment and means of ensuring basic reliability with JMS, here we talk about Persistence, Expiration, Priority and Temporary Queues/Topics.

What are the two delivery modes for messages to specify their Persistence? And, how do you specify them?
The two delivery modes are fields of the DeliveryMode interface and are as follows.

  1. The PERSISTENT delivery mode, which is the default, instructs the JMS provider to take extra care to ensure that a message is not lost in transit in case of a JMS provider failure. A message sent with this delivery mode is logged to stable storage when it is sent.
  2. The NON_PERSISTENT delivery mode does not require the JMS provider to store the message or otherwise guarantee that it is not lost if the provider fails.

Continue reading ‘JMS - Ensuring Reliability | Part - 2′

JMS - Ensuring Reliability | Part - 1


Until a JMS message has been acknowledged, it is not considered to be successfully consumed. The successful consumption of a message ordinarily takes place in three stages.
1. The client receives the message.
2. The client processes the message.
3. The message is acknowledged. Acknowledgment is initiated either by the JMS provider or by the client, depending on the session acknowledgment mode.

What are the basic mechanisms for impacting the reliability of message delivery?
  • ACKNOWLEDGMENT- by specifying various levels of control over message acknowledgment
  • PERSISTENCE - by specifying that messages are persistent, that they must not be lost in the event of a provider failure
  • PRIORITY - by setting various priority levels for messages, which can affect the order in which the messages are delivered
  • EXPIRATION - by specifying an expiration time for messages, so that they will not be delivered if they are obsolete
  • TEMPORARY DESTINATION - by creating temporary destinations that last only for the duration of the connection in which they are created

Continue reading ‘JMS - Ensuring Reliability | Part - 1′

JMS Introduction


Messaging enables distributed communication that is loosely coupled. A component sends a message to a destination, and the recipient can retrieve the message from the destination. However, the sender and the receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver; nor does the receiver need to know anything about the sender. The sender and the receiver need to know only what message format and what destination to use. In this respect, messaging differs from tightly coupled technologies, such as Remote Method Invocation (RMI), which require an application to know a remote application’s methods.

A JMS application is composed of the following parts.

  • A JMS provider is a messaging system that implements the JMS interfaces and provides administrative and control features. An implementation of the JEE platform usually includes a JMS provider.
  • JMS clients are the programs written in the Java that produce and consume messages.
  • JMS Destinations are Queue for a point-to-point messaging and Topic for pub/sub messaging.
  • Messages are the objects that communicate information between JMS clients and destinations.
  • Administered objects are pre-configured JMS objects created by a server administrator for the use of messaging clients. The two kinds of administered objects are destinations and connection factories

Continue reading ‘JMS Introduction’

JMS - Message Driven Bean


A Message Driven Bean or MDB is a JMS message consumer that usually implements some message processing and/or routing logic. The bean registers interest (via deployment descriptor) in a Queue or Topic of its choice, implements MessageListener and MessageDrivenBean interface, and awaits arrival of asynchronous messages.

Does an MDB have a home or a component interface?
Messages are delivered asynchronously to a bean by the messaging service provider (e.g. IBM MQ) or an application server (e.g. JbossMQ). The bean cannot be invoked by a client and hence does not require a home or a component interface.An MDB does not have any client-visible identity or a conversational state - all the instances of the bean are treated equivalent for servicing receipt of a message. Typically, a server creates a pool of MDB instances and keep them in method-ready state. On arrival of a message, one of the instances is assigned to the client. After the onMessage() method execution, the bean is returned to the pool of available beans. The J2EE (now JEE) container essentially controls the lifecycle of such a bean. The component pooling of MDB results in more scalable applications.

Continue reading ‘JMS - Message Driven Bean’

Assignment - XML, Java


Problem

You have to create an XML file denoting a mall with shops having products. Create a program to find the best deal on a product in the given mall. Shops carry different products at different prices.

Write your code in Java. Programs should run from command line. There is no need to develop any GUI components, unless you think we will be impressed by it!

Continue reading ‘Assignment - XML, Java’

Examples of our Technical Assignments


Problem

You have been given a method int r5() which returns a number from 1 to 5. The return values are based on the following rules:

  1. The method returns a random number based on a random seed value (e.g. wind speed at random location at a random time)
  2. Each number from 1 to 5 has an equal probability of being returned

Derive a random method int r7() from r5() which returns a number from 1 to 7 and confirms to the rules above. Continue reading ‘Examples of our Technical Assignments’

Simple Zoom Application in WPF


In this blog, i am going to create a simple Zoom application using WPF. The Classes and controls which i will be using for this purpose are:

Control - Slider
Classes - ImageBrush
Property - Viewbox( Dependency property of ImageBrush) Continue reading ‘Simple Zoom Application in WPF’

Pixel dilemma and WPF


History
The word pixel was first published in 1965 by Frederic C. Billingsley of JPL, to describe the picture elements of video images from space probes to the moon and Mars; but he did not coin the term himself, and the person he got it from (Keith E. McFarland at the Link Division of General Precision in Palo Alto) does not know where he got it, but says it was “in use at the time” (circa 1963).
The word is a combination of picture and element, via pix. Pix was first coined in 1932 in a Variety Magazine headline, as an abbreviation for the word pictures, in reference to movies; by 1938 pix was being used in reference to still pictures by photojournalists.
The concept of a picture element dates to the earliest days of television, for example as Bildpunkt (the German word for pixel, literally picture point) in the 1888 German patent of Paul Nipkow. According to various etymologies, the earliest publication of the term picture element itself was in Wireless World magazine in 1927,though it had been used earlier in various U.S. patents filed as early as 1911. Continue reading ‘Pixel dilemma and WPF’

.NET Logging Framework


Introduction There are various logging solutions available for .NET based applications. All these logging frameworks have certain advantages and disadvantages but all of them aim towards helping the user in identifying and solving issues with the applications when it is almost impossible to take help of other debugging and monitoring tools. This article tries to give you an overview of logging in general with a focus on log4net as one of the most commonly used logging framework for .NET applications. Continue reading ‘.NET Logging Framework’