Search your topic in Java2share
Home > SCBCD > SCBCD Question Bank
eXTReMe Tracker

4. EJB 3.0 Message-Driven Bean Component Contract (SCBCD)

Q: 1 Given code snippets from two files:
7. public class Dog {
8. public void onMessage(Message m) { System.out.print("1 "); }
9. }
10. @MessageDriven
11. class MessageDog extends Dog implements MessageDrivenBean {
12. MessageDog(Message m) { System.out.print("2 "); }
13. }
Which four code changes, when used together, create a valid JMS message-driven bean? (Choose four.)

A. Make class MessageDog public.
B. Make the MessageDog constructor no-arg.
C. Make the MessageDog constructor public.
- 8 -
D. Move the onMessage method to class MessageDog.
E. Change MessageDog so that it is NOT a subclass of Dog.
F. Make class MessageDog implement MessageListener instead of MessageDrivenBean.

Answer: A, B, C, F

Q: 2 A developer writes a stateful session bean called FooBean.
Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment
dependency on a JMS Topic?
11. public class FooBean {
13. public void foo() {}
15. }

A. @Resource(type=Topic.class)
B. @Resource(name="topicRef")
private static Topic topic;
C. @Resource private Topic topic;
D. @Resource(name="topicRef", type=Topic.class)

Answer: D

Q: 3 Which two statements are correct? (Choose two.)
A. An EJB 3.0 message-driven bean can itself be the client of another message-driven bean.
B. The client of an EJB 3.0 message-driven bean can use the bean's remote business interface to communicate
with the bean.
C. Every client of an EJB 3.0 JMS message-driven bean must be a Java application that uses the JMS API to
communicate with the bean.
D. Messages sent to JMS topics are intended for only one receiver whereas messages sent to JMS queues are
intended for multiple receivers.
E. If the client of an EJB 3.0 message-driven bean awaits a reply to its request, the client can set the
JMSReplyTo attribute to provide routing information to the bean.

Answer: A, E

Q: 4 Click the Task button.
Place the EJB 3.0 JMS Message-Driven Bean class code snippets on their corresponding locations.