When to use an EJB and when not to

Discussions

EJB design: When to use an EJB and when not to

  1. When to use an EJB and when not to (5 messages)

    We are developing a new product and contemplating whether or not we should use an EJB for the product.

    What we need is something that send a request to a third-party website and process the request that comes back from that website. So it's just basically hitting a URL and we are processing the information that comes back from that hit. This is the backbone of a certain application and will be hit numerous times.

    Since it only hits a url and doesn't require a database connection or any other valuable resource..should it be an EJB or just a simple servlet?

    Threaded Messages (5)

  2. Hi,


    What you are going to do after geting information from that website.

    depending upon that only, you need to decide whether you ejb or not.

    You store it permently with database, then go for ejb.
    otherwise, no need ejb there.

    -Kannan
  3. hai
      I suppose there is no need to go for an ejb in the present case. If there is any need for the underlying primary services offered by an app. server (e.g. transactions etc), then we can go for ejbs.
     
  4. Rather than looking at it from a Systems perspective (transactions, persistence, etc), I suggest you mull over whether the functionality you described needs to be used by several applications within your enterprise? Is this something that can be perceived as a component providing Business functionality that may need to be re-used by other applications? If the answer is yes, you can think of using a Session Bean to provide this functionality.

    HTH - Sachin.
  5. Bhavin,

    Just a follow up to my previous post.

    Since you are hitting another URL, you are doing socket communications indirectly. Based on my understanding of the EJB 1.1 specs and reading some related posts here, this is something that is discouraged for an EJB.

    You may want to hit the URL using a helper class used by a servlet and then pass the data to a stateless Session Bean to do the business processing.

    Sachin.
  6. When to use an EJB and when not to[ Go to top ]

    Read the article at

    http://www-4.ibm.com/software/developer/library/ibm-ejb/index.html


    Ravi