Spring Questions and Answers – Spring Batch and Gateways

«
»

This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Spring Batch and Gateways”.

1. To take an input file or a payload and reliably, and systematically, decompose it into events that an ESB can work with:-
a) Splitter
b) Spring Batch
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: b
Explanation: You have a file with a million records in it. This file’s too big to handle as one event; it’s far more natural to react to each row as an event. Spring Batch works very well with these types of solutions. It allows you to take an input file or a payload and reliably, and systematically, decompose it into events that an ESB can work with.
advertisement

2. Spring Integration does support reading files into the bus.
a) True
b) False
View Answer

Answer: a
Explanation: Spring Batch does support providing custom, unique endpoints for data.

3. No processing system (such as an ESB) can deal with a million records at once efficiently.
a) True
b) False
View Answer

Answer: a
Explanation: Strive to decompose bigger events and messages into smaller ones.

4. Spring Batch reads the file, transforms the records into:-
a) objects
b) outputs
c) all of the mentioned
d) none of the mentioned
View Answer

Answer: a
Explanation: Spring Batch reads the file, transforms the records into objects, and writes the output to a JMS topic with a key correlating the original batch to the JMS message.

5. The BPM engine would thread together the different actors and work lists,
a) True
b) False
View Answer

Answer: a
Explanation: The BPM engine would thread together the different actors and work lists, allow work to continue over the course of days instead of the small millisecond timeframes Spring Integration is more geared to.

6. You want to expose an interface to clients of your service, without betraying the fact that your service is implemented in terms of messaging middleware.
a) Enterprise Integration Patterns
b) Gateway
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: Use a gateway—a pattern from the classic book Enterprise Integration Patterns by Gregor Hohpe and Bobby Woolf (Addison-Wesley, 2004) that enjoys rich support in Spring Integration.
advertisement

7. Serving to abstract away the functionality of other components in an abbreviated interface to provide courser functionality.
a) facade
b) façade
c) gateway
d) none of the mentioned
View Answer

Answer: b
Explanation: You might use a façade to build an interface oriented around vacation planning that in turn abstracts away the minutiae of using a car rental, hotel reservation, and airline reservation system.

8. The capability to hide messaging behind a POJO interface.
a) Lingo
b) JCA
c) JMS
d) All of the mentioned
View Answer

Answer: d
Explanation: Lingo, a project from Codehaus.org that is no longer under active development, had such a feature that was specific to JMS and the Java EE Connector Architecture (JCA –it was originally used to talk about the Java Cryptography Architecture, but is more commonly used for The Java EE Connector Architecture now).

9. The most fundamental support for gateways comes from the Spring Integration class:-
a) SimpleMessagingGateway
b) SimpleMessaging
c) SimpleGateway
d) None of the mentioned
View Answer

Answer: a
Explanation: The class provides the ability to specify a channel on which requests should be sent and a channel on which responses are expected.

10. The SimpleMessagingGateway needs a request and a response channel, and it coordinates the rest.
a) True
b) False
View Answer

Answer: a
Explanation: You’re doing nothing but forwarding the request to a service-activator, which in turn adds the operands and sends them out on the reply channel.

11. The first thing that the client configuration does is import a shared application context (to save typing if nothing else) that declares a JMS connection factor.
a) True
b) False
View Answer

Answer: a
Explanation: The first thing that the client configuration does is import a shared application context (to save typing if nothing else) that declares a JMS connection factory that you reference in the client and service application contexts.

12. Messages sent on the requests channel are forwarded to the:-
a) jms:outbound-gateway
b) jms:outbound
c) jms-gateway
d) all of the mentioned
View Answer

Answer: a
Explanation: The jms:outbound-gateway is the component that does most of the work. It takes the message you created and sends it to the request JMS destination, setting up the reply headers and so on.
advertisement

13. The gateway element simply exists to identify the component and the interface.
a) True
b) False
View Answer

Answer: a
Explanation: The gateway element simply exists to identify the component and the interface, to which the proxy is cast and made available to clients.

14. There is no coupling between the client facing interface exposed via the gateway component and the interface of the service that ultimately handles the messages.
a) True
b) False
View Answer

Answer: a
Explanation: We use the interface for the service and the client to simplify the names needed to understand everything that’s going on.

15. The service-activator is what handles actual processing and there’s no mention of a response channel, for either the service-activator, or for the inbound JMS gateway.
a) True
b) False
View Answer

Answer: a
Explanation: The service-activator looks, and fails to find, a reply channel and so uses the reply channel created by the inbound JMS gateway component, which in turn has created the reply channel based on the header metadata in the inbound JMS message.

Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn