try putting this code in the setMessageDrivenContext() method of your
mdb.
On Tue, 2001-11-13 at 18:20, [EMAIL PROTECTED] wrote:
> We have a MDB that processes messages, we need it to put the results in
> ANOTHER queue.
> 
> This does not work right now, as per a couple of examples I found on the web
> this is what we are trying
> 
>     public void ejbCreate() throws EJBException, CreateException
>     {
>         try
>         {
>             InitialContext context = new InitialContext();
> 
>             QueueConnectionFactory conFactory = ( QueueConnectionFactory
> )context.lookup( CONNECTION_FACTORY );
>             // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>             // Create a JMS connection
>             this.connection = conFactory.createQueueConnection();
>             // Create a JMS session object
>             this.session = connection.createQueueSession( false,
> Session.AUTO_ACKNOWLEDGE );
>             // Start the connection so we can use it
>             this.connection.start();
>             // Lookup a JMS queue     
>             this.searchResultsQueue = ( Queue )context.lookup( QUEUE_NAME );
>             // Create a JMS sender
>             this.sender = session.createSender( this.searchResultsQueue );
> 
>         }
>         catch ( Exception e )
>         {
>             // error is logged by our logging service
>         }
> 
> the line that looks up the connection factory fails
> if we move this to onMessage() it works, where should this go to avoid
> creating this on EVERY message.
> 
> ejbCreate() is the "CORRECT" place as per all the examples and everything
> else.
> 
> Jarrod Roberson
> 
> 



Reply via email to