250+ TOP MCQs on Splitters and Aggregators,Routing and Answers

Java Spring Multiple Choice Questions & Answers (MCQs) on “Splitters and Aggregators,Routing”.

1. To fork the process flow from one component to many, either all at once or to a single one based on a predicate condition.
a) splitter
b) fork
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: You can use a splitter component (and maybe its cohort, the aggregator component) to fork and join (respectively) control of processing.

2. A splitter takes an input message and asks you, the user of the component, on what basis it should split the Message.
a) True
b) False
View Answer

Answer: a
Clarification: You’re responsible for providing the split functionality.

3. Spring Integration ships with useful splitters that require no customization.
a) Splitter
b) XPathMessageSplitter
c) All of the mentioned
d) None of the mentioned
Answer: b
Clarification: In a few cases, Spring Integration ships with useful splitters that require no customization. One example is the splitter provided to partition an XML payload along an XPath query, XPathMessageSplitter.

4. Return type of the method annotated by the @Splitter annotation is of type:-
a) java.util.Collection
b) java.util.Date
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: The configuration for this is not terribly different from the previous solutions. The Java code is just about the same as well, except that the return type of the method annotated by the @Splitter annotation is of type java.util.Collection.

5. Annotation which collects a series of messages (based on some correlation that you help Spring Integration make between the messages).
a) @After
b) @Splitter
c) @Aggregator
d) None of the mentioned
Answer: c
Clarification: An @Aggregator collects a series of messages (based on some correlation that you help Spring Integration make between the messages) and publishes a single message to the components downstream.

6. To determine how many messages to read until it can stop:-
a) SequenceSizeCompletionStrategy
b) SequenceSizeCompletion
c) SequenceSize
d) None of the mentioned
Answer: a
Clarification: There are many ways for Spring Integration to correlate incoming messages. To determine how many messages to read until it can stop, it uses the class SequenceSizeCompletionStrategy, which reads a well known header value (aggregators are often used after a splitter.

7. For correlation when you might not have a size but know that you’re expecting messages that share a common header value within a known time, Spring Integration provides the HeaderAttributeCorrelationStrategy.
a) True
b) False
Answer: a
Clarification: In this way, it knows that all messages with that value are from the same group, in the same way that your last name identifies you as being part of a larger group.

8. The only custom logic is a POJO with an @Aggregator annotation on a method expecting a collection of Message objects.
a) True
b) False
View Answer

Answer: a
Clarification: It could, of course, be a collection of Customer objects, because they are what you’re expecting as output from the previous splitter.

9. You want to conditionally move a message through different processes based on some criteria.
a) router component
b) EAI
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: You can use a router component to alter the processing flow based on some predicate. You can also use a router to multicast a message to many subscribers (as you did with the splitter).

10. There are some convenient default routers available to fill common needs:-
a) PayloadTypeRouter
b) PayloadType
c) Payload
d) None of the mentioned
Answer: a
Clarification: There are some convenient default routers available to fill common needs, such as payload-type–based routing (PayloadTypeRouter) and routing to a group or list of channels (RecipientListRouter).

11. To receive messages from an external system and process them using Spring Integration.
a) channel
b) channel adapter
c) EJP
d) none of the mentioned
Answer: b
Clarification: Spring Integration makes it trivially easy to build one.

12. Adapters are opaque in nature.
a) True
b) False
Answer: a
Clarification: Your external system interfaces with the adapter.

13. Sometimes, functionality is made available from within the application via:-
a) Stable API
b) Cohesive API
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: Sometimes, functionality is made available from within the application via a cohesive, stable API but in a component model or form that isn’t directly accessible to the bus.

14. You use Spring Integration’s inbound-channel-adapter element to wire the TwitterMessageSource and a poller element.
a) True
b) False
Answer: a
Clarification: The poller element is configured to run every 10 seconds and to consume as many as 100 messages each time it runs.

15. The API surfaces a Paging object, which works something like Criteria in Hibernate.
a) True
b) False
Answer: a
Clarification: You can configure how many results to return using the count property. The most interesting option is called the sinceId, which lets you search for all records occurring after the Status having the ID equal to the value given as the sinceId.


Leave a Reply

Your email address will not be published. Required fields are marked *