EJB Asynchronous communication

What is a message-driven bean?

- A MDB is one of the enterprise bean that allows an EJB application to perform messages asynchronously.

- It is a message listener similar to event listener, that receives messages instead of events.

- It is similar to JMS message listener.

- Unlike a session bean or entity bean, a message driven bean has only a bean class.

- The message process starts when the container calls the message-driven bean’s onMessage method soon after a message arrives.

Explain the need for Asynchronous Communication.

Need of Asynchronous Communication :

- Any application process will be continued while the communication is being processed, using asynchronous communication. The receipt of the message may not be immediate for the application that directs the message.

- The messages can be sent to various applications which are care to listen.

- We can use asynchronous communication which are platform independent that supports Java technologies such as IBM’s MQ Series, JMS.

- It is possible to convert one of the applications from COBOL to Java, which does not need any changes to other senders and receivers of the messages.

What is the JMS messaging?

- The JMS is an API that makes the different applications components which are JSE,JEE based.

- The JMS messaging standard allows the messages to create, send, receive and read messages.

- The characteristics of JMS messaging are – loosely coupled, reliable and asynchronous.

- The JEE enterprise computing problems can be solved by using the JMS API powerful tool.

- The JMS API improves the productivity of messaging concepts, strategies of programming which are supported by all JMS compliant messaging services.

Explain the JavaMail API. Explain how it is used to compose and dispatch a mail.

- Java Mail is a protocol independent, platform independent mailing and messaging services for Java based applications.

- The present protocols like PostOfficeProtocol, SimpleMailTransferProtocol can be used to send a mail.

- The use of Java mail is not to adhere to any protocol over a network.

- The javax.mail.internet.MimeMessage objects are used to represent an E-mail using Java Mail.

- The following are the methods that correspond message objects.

1. setSubject() – Used to specify the subject of the message
2. setContent ()– Used to specify the content of the message
3. setRecipients() – Used to specify the address of the recipient
4. addFrom() Used to add the addresses to the existing "From" attribute.

- The InternetAddress class represents the e-mail address.

Procedure :

- Pass the session object as the parameter to the constructor of MimeMessage object. This creates an initially empty message.

- Add the necessary content to the message using the methods setSubject(),setContent(),setReceipients(),addForm() .

- Send the message using send() method.
EJB environment
EJB environment - What is the Enterprise Bean Environment?, Explain the EJB environment Entries, Explain the steps involved in accessing one enterprise bean from other.
EJB Resource Manager
EJB Resource Manager - What is a Resource Manager Connection factory?, Explain the five types of resource manager that J2EE compliant application server must support.
EJB security
EJB security - EJB security model, What are the EJB-specific issues in security management? Ways to authenticate a client before it contacts the server?, steps involved in security design for EJB application.
Post your comment