Re: [JBoss-user] MDB...why?

2001-05-16 Thread jsoriano

Hello Peter:

Let's go with another example and you would say me
if (now, at last, thanks god ;-) am i in the correct way:

An imaginary assumption: i wanna write an application to manage
a Mail List in this way:

Topic publisher side
--
A servlet obtains a lot of information (news) about 'Sport', 'Cinema'
and 'Computers'. This program sends messages to a Topic which 
include 'subject', 'theme' and 'body' fields.

Topic subscriber side
-
Three (diferent) listeners called 'listenSport', 'listenCinema' and 
'listenComputers' wait for a message with its 'theme' field equals
to 'Sport', 'Cinema' or 'Computers', respectively.

Each Listener will call outers Session Beans which transform
the 'body' field in an HTML format (for Sports), PDF format (for Cinema)
and Plain-text format (for Computers) and then, every Session Bean send
an e-mail to [EMAIL PROTECTED], [EMAIL PROTECTED] or 
[EMAIL PROTECTED]
with its respective attachment.

Everything will occur without 'bothering' the servlet. In the other hand, 
writing 3 diferent Listeners will allow us to change (separately) the 
formating task asociated to each Listener, and, in the future,
add new Listeners for new themes.

Regards:
__
Jaume Soriano Sivera [EMAIL PROTECTED]
__




[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
15/05/2001 21:43
Please respond to jboss-user

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [JBoss-user] MDB...why?


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]
 __
 
 
 
 
 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

Re: [JBoss-user] MDB...why?

2001-05-16 Thread Peter Antman

On 16 Maj, [EMAIL PROTECTED] wrote:
 Hello Peter:
 
 Let's go with another example and you would say me
 if (now, at last, thanks god ;-) am i in the correct way:

Hi, sound like a perfect match, and a good example to. Remember, if the
sessions beans all have the same remote interface, the code for the MDB
may be exactly the same. You could specify the name of the session bean
in the deployment descriptor, which means that adding a new listener is
just a matter of configuring the deploymentdescriptors and deploy into
the running server.

//Peter

 
 An imaginary assumption: i wanna write an application to manage
 a Mail List in this way:
 
 Topic publisher side
 --
 A servlet obtains a lot of information (news) about 'Sport', 'Cinema'
 and 'Computers'. This program sends messages to a Topic which 
 include 'subject', 'theme' and 'body' fields.
 
 Topic subscriber side
 -
 Three (diferent) listeners called 'listenSport', 'listenCinema' and 
 'listenComputers' wait for a message with its 'theme' field equals
 to 'Sport', 'Cinema' or 'Computers', respectively.
 
 Each Listener will call outers Session Beans which transform
 the 'body' field in an HTML format (for Sports), PDF format (for Cinema)
 and Plain-text format (for Computers) and then, every Session Bean send
 an e-mail to [EMAIL PROTECTED], [EMAIL PROTECTED] or 
 [EMAIL PROTECTED]
 with its respective attachment.
 
 Everything will occur without 'bothering' the servlet. In the other hand, 
 writing 3 diferent Listeners will allow us to change (separately) the 
 formating task asociated to each Listener, and, in the future,
 add new Listeners for new themes.
 
 Regards:
 __
 Jaume Soriano Sivera [EMAIL PROTECTED]
 __
 
 
 
 
 [EMAIL PROTECTED]
 Sent by: [EMAIL PROTECTED]
 15/05/2001 21:43
 Please respond to jboss-user
 
  
 To: [EMAIL PROTECTED]
 cc: 
 Subject:Re: [JBoss-user] MDB...why?
 
 
 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]
 __
 
 
 
 
 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

Re: [JBoss-user] MDB...why?

2001-05-15 Thread pra

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: 96504 -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 ArchitectWWW: 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] MDB...why?

2001-05-14 Thread jsoriano

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

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?

Excuse me if these questions sounds so 'simple' but i need 
a little help to understand MDB cause i'm really interested
in learning everything about JBOSS.
Thanks in advance!

__
Jaume Soriano Sivera [EMAIL PROTECTED]
__

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



Re: [JBoss-user] MDB...why?

2001-05-14 Thread jsoriano

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...

Please, am i in the correct way?

Thank you again!
__
Jaume Soriano Sivera [EMAIL PROTECTED]
Tel: 96504 -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



Re: [JBoss-user] MDB...why?

2001-05-14 Thread Thomas Hagedorn

Hi,

as far as I understand, MDB's are designed for 2 main issues.

1. to enable an asynchrone communication mechanism (i.e. to trigger
some actions where the client has no need to wait for the result.)
2. to enable a listener mechanism where sending and recieving processes
could be connected in a very flexible way (i.e. a new listener is
connected to en existing Topic to do additional things, so you must not
change anything in the former part of  your app.)

In your case, the sending process has to know the result of the
operation, so I think this is no good design to use MDBs in this part.
A good place for an MDB may be the part where you trigger the next
steps in handling the purchase ( i.e. tell the workers to pack the
books and write a bill).

HTH
tom

On Mon, 14 May 2001, you 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
 
 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?
 
 Excuse me if these questions sounds so 'simple' but i need 
 a little help to understand MDB cause i'm really interested
 in learning everything about JBOSS.
 Thanks in advance!
 
 __
 Jaume Soriano Sivera [EMAIL PROTECTED]
 __
 
 ___
 JBoss-user mailing list
 [EMAIL PROTECTED]
 http://lists.sourceforge.net/lists/listinfo/jboss-user
-- 
THETA - Consulting   
Kommuniktionsanalyse - Anwendungsentwicklung - LINUX-Systeme

Thomas Hagedorn  Tel. 07231-472108
Rainstr. 12  Tel. 0172-7642398
75217 Birkenfeld [EMAIL PROTECTED]

Jesus inside - where do you want to go forever ?

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



New: [JBoss-user] MDB...why?

2001-05-14 Thread jsoriano

(Excuse me if this e-mail appears twice)

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...

Please, am i in the correct way?

Thank you again!
__
Jaume Soriano Sivera [EMAIL PROTECTED]
Tel: 96504 -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



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



Re: New: [JBoss-user] MDB...why?

2001-05-14 Thread Per Lewau


I seemed to have ranted abit, but I hope you'll find this useful.


On Mon, 14 May 2001 [EMAIL PROTECTED] wrote:

 (Excuse me if this e-mail appears twice)
 
 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?

One. The ListernerBean is the one subscriber to the Topic topic/testTopic.

 I think a subscriber is 'Worker Bean', isn't it?

The subscriber is the ListernerBean. When the listener bean receives a
message it calls the WorkerBean.

 Then, to have more than one subscriber i've to create other Beans
 similar (or not) to Worker Bean, haven't i?

(I see know why you talked about using a Topic in your last mail (that's
what's great about helping others, innit?). The reason for using a topic
is to be able to send an event to many event listeners.)

The Worker bean is an ordinary Session Bean and is not directly involved
in the JMS thingy. Lets call a message published on the topic a WorkEvent
that triggers that work should be done (man, I'd hate one of those ;).
In the example the ListenerBean receives that event and instead of doing
the work himself he delegates (sweet) it to the WorkerBean. If you'd want
more beans to listen to that event then yes, you'd have to modify the
ListenerBean to also call those other beans.

The idea is that there should be one Topic for all events and that the
ListenerBean is responisble for sending events on to other beans (the
actual listeners, so to speak). I'd say that the idea is a little lost in
the example as it is too simple. 

The advantage of having one Topic and one subscriber is that you only have
to reconfigure that subscriber, something which could be done via the
environment. The advantage doesn't really become apparent when you have
only one event; you could just attach many MDBs to that Topic.
However, when you want to add more events you'd have to add more Topics
and that would require restarting the server (right now, Topics added
while the server is running are not recreated when the server is restarted
(are they?)).


 So, if i create new beans i have to modify my Listener to be able to
 comunicate with the new subscriber...

Yes.

 Please, am i in the correct way?

You are.


Cheers

 
 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]

RE: [JBoss-user] MDB...why?

2001-05-14 Thread Nikhil Patil

Hi
I really don't know if you need a MDB. You can achieve your goal by the
servlet invoking the Checker bean directly.
You're functinality is synchronous in nature. YOu could use MDB to do the
same, however it would be unnecessary use of resources.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Per Lewau
Sent: Monday, May 14, 2001 7:08 AM
To: [EMAIL PROTECTED]
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