- See Also:
- Top Examples, Source Code
public void onMessage(Message message)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[171]Simple MDB
By Anonymous on 2003/02/25 11:42:38 Rate
import javax.jms.*;
public class HelloBean implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener {
javax.ejb.MessageDrivenContext _mc;
public void setMessageDrivenContext ( javax.ejb.MessageDrivenContext ctx ) {
_mc = ctx;
}
public void ejbCreate ( ) { }
public void ejbRemove ( ) { }
public void onMessage ( javax.jms.Message msg ) {
try {
if ( msg instanceof javax.jms.TextMessage ) {
javax.jms.TextMessage message = ( TextMessage ) msg;
System.out.println ( "Received message: " + message.getText ( ) ) ;
} else {
System.out.println ( "Message of wrong type: " + msg.getClass ( ) .getName ( ) ) ;
}
}
catch ( JMSException ne ) {
...
}
}
}