Thursday, 31 March 2016

EJB3.x Deployment in JBoss

EJB - Enterprise Java Beans
=================

Session Beans - Synchronus - Meant for wring Business logic
Entity Beans - Synchronus - DAL - replaced by JPA/Hibernate
MDB(Message Driven Beans) - Asynchronus


Messaging - Two components talking to each other.

Messaging of two types : 
Synchronous - Request/Reply mechanism ; lightly coupled
Asynchronous - fire and Forget kind of mechanism, It doesn't really wait for a response, instead it leaves a listener, whenever the response coming in as a message, a thread will take care of it.


MOM - Message oriented Middle ware products
WebSphere MQ/MB - IBM
ACTIVE MQ  - APACHE
APOLOGETIC
RABBIT MQ
HARNET MQ - JBOSS- RED HAT (implemented as messaging subsystem but only available in full,full-ha profile)

Types of Asynchronous Messaging :
Point to Point Messaging - you work with original copy of the message. Queues we need to configure.
Public Subscribe Messaging - Multiple publishers, multiple subscribers.
A copy of the message will be sent to subscribers.
Eg: Twitter, If AB post a tweet , all the followers would get a copy of the tweet.


When two components implemented in different languages ,still they can talk each other.

1)Declarative transaction/security (everything via xml in terms of configuraiton)
2)Multilayered Architecture

Spring far better when it comes to DT and MA discussed above.
If you go with Spring , Apache is just enough, free of cost.



Session Beans : 

JNDI names

Ejb client (jvm one) ----> Ejb (Jboss jvm)
You can call from one jvm to another jvm.

EJB:Remote Interface (call to an external jvm)Local Interface (with in the same jvm) ; much better performance

JMS - Java Messaging Service

JMS is to connect MOM products.


Java application need to connect to MOM product to put a message/retrieve a message.

JMS API - java api


java appication --->jms api ---> [MOM products to put/retrieve messages]

your application use verdor provided api or jmi api to use MOM product.

1)Use vendor api for messaging (full utilization of messaging, hard binding to that product, will be hard to migrate to diff mq later)
2)Use JMS api (limited use of messagin, will be easy to migrate to diff MQ)


Follow the steps to create JMS application.

1)Connection Factory
2)Create a Destination - Queue or Topic





No comments:

Post a Comment