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’
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’
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’
A very useful tool for compulsive surfers and bloggers. Instead of storing link, store what’s relevant on those links, share them, post em on your blogs, or mash em up with data marts. Continue reading ‘Clipmarks saves our lives’
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:
- The method returns a random number based on a random seed value (e.g. wind speed at random location at a random time)
- 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’