A MessageDriven Bean Example FTP App' - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

A MessageDriven Bean Example FTP App'

Description:

A Message-Driven Bean Example FTP App. Peng-sheng,chen. Example Application Overview ... It must not define the finalize method. The onMessage Method ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 11
Provided by: Peng92
Category:

less

Transcript and Presenter's Notes

Title: A MessageDriven Bean Example FTP App'


1
A Message-Driven Bean Example FTP App.
  • Peng-sheng,chen

2
Example Application Overview
  • This application has the following components
  • FtpMessageClient A J2EE application client that
    sends file object messages to a queue.
  • FtpMessageBean A message-driven bean that
    asynchronously receives and processes the file
    object messages that are sent to the queue.

3
The J2EE Application Client
  • queueConnectionFactory (QueueConnectionFactory)
    jndiContext.lookup ("javacomp/env/jms/MyQueueConn
    ectionFactory")
  • queue (Queue) jndiContext.lookup("javacomp/env/
    jms/QueueName")

4
The Message-Driven Bean Class
  • The Message DrivenBean and Message Listener
    interfaces.
  • The onMessage method.
  • It implements one ejbCreate method and one
    ejbRemove method.
  • It contains a public constructor with no
    arguments.
  • It must not define the finalize method.

5
The onMessage Method
  • When the queue receives a message, the EJB
    container invokes the onMessage method of the
    message-driven bean.
  • In the FtpMessageBean class, the onMessage
    method casts the incoming file to a FileMessage
    and displays the file successful sending message.

6
The ejbCreate and ejbRemove Methods
  • The access control modifier must be public.
  • The return type must be void.
  • The modifier cannot be static or final.
  • The throws clause must not define any application
    exceptions.
  • The method has no arguments

7
JAVA File I/O
8
Modify Security file
  • Locate at j2sdkee1.3.1\lib\security
  • Modify server.policy
  • Type grant permissionjava.security.AllPermission

9
JNDI Names  
10
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com