Java Spring Multiple Choice Questions & Answers (MCQs) on “Integration of Systems”.
1. Integration of Spring which has each application produce files of shared data for others to consume.
a) File transfer
b) Shared Database
c) Remote Procedure Invocation
d) Messaging
Answer: a
Clarification: File transfer: Have each application produce files of shared data for others to consume and consume files that others have produced.
2. Integration of Spring which has the applications store the data they want to share in a common database.
a) File transfer
b) Shared Database
c) Remote Procedure Invocation
d) Messaging
Answer: b
Clarification: This usually takes the form of a database to which different applications have access.
3. Integration of Spring which has each application expose some of its procedures so that they can be invoked remotely and have applications invoke them to initiate behavior and exchange data.
a) File transfer
b) Shared Database
c) Remote Procedure Invocation
d) Messaging
Answer: c
Clarification: There is specific support for optimizing RPC (remote procedure calls such as SOAP, RMI, and HTTP Invoker) exchanges using Spring Integration.
4. Integration of Spring which has each application connect to a common messaging system and exchange data and invoke behavior using messages.
a) File transfer
b) Shared Database
c) Remote Procedure Invocation
d) Messaging
Answer: d
Clarification: This style, most enabled by JMS in the JEE world, also describes other asynchronous or multicast publish/subscribe architectures.
5. Using an ESB lets you hide the origin of the message from the code that’s handling it.
a) True
b) False
Answer: a
Clarification: You’ll use this solution as an easy way to see how a Spring Integration solution can be built.
6. As with a standard MDP, a configuration for the ConnectionFactory exists.
a) True
b) False
Answer: a
Clarification: There’s also a lot of other schem as required for using the configuration elements available in Spring Integration.
7. The configuration starts with the inboundHelloJMSMessageChannel channel, which tells Spring Integration what to name the point-to-point connection from the message queue to the:-
a) service-activator
b) service
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: You typically define a new channel for every point-to-point connection.
8. An adapter is a component that knows how to speak to a specific type of subsystem and translate messages on that subsystem into something that can be used in the Spring Integration bus only.
a) True
b) False
Answer: a
Clarification: Adapters also do the same in reverse, taking messages on the Spring Integration bus and translating them into something a specific subsystem will understand.
9. A service-activator, however, only helps you invoke your application’s business logic on receipt of a message.
a) True
b) False
Answer: a
Clarification: What you do in the business logic, connecting to another system or not, is up to you.
10. The next component, a service-activator, listens for messages coming into that channel and invokes the bean referenced by the:-
a) ref
b) after
c) before
d) all of the mentioned
Answer: a
Clarification: The next component, a service-activator, listens for messages coming into that channel and invokes the bean referenced by the ref attribute, which in this case is the bean defined previously: inboundHelloWorldJMSPingServiceActivator.
11. Headers Found in Spring Integration Messages:-
a) ID
b) TIMESTAMP
c) CORRELATION_ID
d) All of the mentioned
Answer: d
Clarification: Constant ID This is a unique value assigned to the message by the Spring Integration engine.
TIMESTAMP Timestamp assigned to the message.
CORRELATION_ID This is optional. It is used by some components (such as aggregators) to group
messages together in some sort of processing pipeline.
REPLY_CHANNEL The String name of the channel to which the output of the current component
should be sent. This can be overridden.
ERROR_CHANNEL The String name of the channel to which the output of the current component
should be sent if an exception bubbles up into the runtime. This can be overridden.
EXPIRATION_DATE Used by some components as a threshold for processing after which a component
can wait no longer in processing.
SEQUENCE_NUMBER The order in which the message is to be sequenced; typically used with a sequencer.
SEQUENCE_SIZE
838
Description
The size of the sequence so that an aggregator can know when to stop waiting for
more messages and move forward. This is useful in implementing “join”
functionality.
12. Some header values are specific to the type of the source message payload.
a) True
b) False
Answer: a
Clarification: Some header values are specific to the type of the source message payload; for example, payloads sourced from a file on the file system are different from those coming in from a JMS queue, which is different from messages coming from an email system.
13. Component-specific headers are the constants defined for files on:-
a) org.springframework.integration.file.FileHeaders: FILENAME
b) org.springframework.integration.file.FileHeaders: PREFIX
c) all of the mentioned
d) none of the mentioned
Answer: c
Clarification: An example of component-specific headers are the constants defined for files on org.springframework.integration.file.FileHeaders: FILENAME and PREFIX.
14. Annotation to get access to header metadata:-
a) @Ref
b) @service
c) @Header
d) None of the mentioned
Answer: c
Clarification: Another way to get access to header metadata is to simply have it passed as parameters to your component’s method. You simply annotate the parameter with the @Header annotation, and Spring Integration will take care of the rest.
15. The code for the service-activator has changed to reflect the fact that you’re expecting a message containing a message of type:-
a) Message
b) Message
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: The code for the service-activator has changed to reflect the fact that you’re expecting a message containing a message of type Message