On 14 Maj, [EMAIL PROTECTED] wrote:
> Thank you Per!!
> 
> The origin of this confusion is a sample in JBoss Documentation,
> making more specific: example called "MDB as a Listener".
> 
> How many "subscribers" appear in this example?
> I think a subscriber is 'Worker Bean', isn't it?
> Then, to have more than one subscriber i've to create other Beans
> similar (or not) to Worker Bean, haven't i?
> So, if i create new beans i have to modify my Listener to be able to
> comunicate with the new subscriber...

The ListenerBean is the subscriber. The logic is partitioned so that the
work is done in the stateless session  bean. Not that it is necesarry in
this example, but only to show how it is possible to do it.

When it commes to an MDB, you deploy one version (name, configuration)
for each logic and topic/selector combination.

Some areas to use this?

- A time task run in JMX could send its task to a queue. An MDB listens
  for missions and delegate to a sessiion bean (or does the work for
  itself).

- A bean get some cind of thing to do. To continue it need to wait one
  some cind of event (perhaps the presence of something). It triggers
  this and returns. A message bean listens on a queue where the event
  will be placed and calls the session bean (that perhaps has saves som
  temporary persistens data throug an entity bean from the earlier
  invokation, which it now uses.

//Peter
> 
> Please, am i in the correct way?
> 
> Thank you again!
> __________________________________________
> Jaume Soriano Sivera <[EMAIL PROTECTED]>
> Tel: 965040000 -ext. 44744 Fax: 965040047
> Portal y servicios multimedia - Nuevas tecnologias 
> W a n a d o o E s p a n a - http://www.wanadoo.es 
> __________________________________________
> 
> 
> 
> 
> Per Lewau <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
> 14/05/2001 13:08
> Please respond to jboss-user
> 
>  
>         To:     [EMAIL PROTECTED]
>         cc: 
>         Subject:        Re: [JBoss-user] MDB...why?
> 
> 
> 
> On Mon, 14 May 2001 [EMAIL PROTECTED] wrote:
> 
>> Hi:
>> I'm testing JBoss with MDB but i'm still lost about its
>> utility...
>> I'd like to write an application to manage a little 
>> "web-shop" using EJBs and MDBs as follows:
>> 
>> * A java servlet who takes data from web application, i.e.
>>    the identifier of a client who wants to buy a book.
>> 
>> * Before allowing this purchase i want to check if this client
>>    is not in my 'defaulter list'.
>> 
>> * After this i'll be able to avoid/allow the purchase.
>> 
>> Well, i though to do this:
>> 
>> "The servlet takes data from web client and sends it to a Topic,
>> then Topic sends data to a Checker Bean that runs a method 
>> called 'checkClient' wich look for this client in a 'defaulter' 
> database.
>> If everything is ok, a 'true' value is returned to servlet"
> 
> Sounds more like a Queue than a Topic to me. Queues are for point-to-point
> messages and Topics are for Publisher/Subscriber (many receivers).
> 
>> Is this a good way to pose my problem?
>> I know its possible to develope *the same* without MDBs, but,
>> is there any advantage on using MDBs?
>> in other words, how can i take advantage of MDBs?
> 
> I'm not sure what you are trying to do, but this is my take on what you
> want.
> 
> 0. MDB listens for messages on in queue
> 1. serlvet sends message to in queue with whatever should be checked
> 2. servlet waits for message on out queue 
> 3. MDB.onMessage() called 
> 4. MDB checks whatever 
> 5. MDB sends message (true or false) to out queue 
> 6. servlet receives message and proceeds
> 
> 
> I'd say that the advantage of MDBs is that they can be called
> asynchronously. What you want to do sound synchronous and while possible
> to do it just adds a lot of overhead. A session bean is easier and faster.
> 
> To me it seems as though MDBs are useful for triggering some action that
> you don't want to hang around waiting for. For instance, you might want to
> send an email with an order confirmation and personally I wouldn't want to
> hang around in my "process order" session bean waiting for JavaMail to
> finish (after all it is talking SMTP to a mail server somewhere) so I
> would simple put a message in a queue and let an MDB deal with the sending
> of emails.
>  
> Regards, Per
> 
> -----------------------------------------------------------------------
> Per Lewau ([EMAIL PROTECTED]) 
> 
> "Why waste time learning, when ignorance is instantaneous?"
>                  - Hobbes
> 
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user

-- 
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]        WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to