Chapter 4. Service interaction patterns

 

This chapter covers

  • Remote interaction
  • Local interaction
  • Request response interaction
  • One-way interaction
  • Conversational interaction
  • Callback interaction

Components may interact with one another in different ways. It’s similar to the way we interact with other people. For example, when Mary books a holiday using a travel agent, she may decide to visit them and talk to them directly, she may have to wait for them to call her back with some information, and she will certainly have an ongoing conversation about the holiday she’s booking.

SCA defines common service interaction patterns and makes it simple to create component services and references that exploit them. In this chapter we’ll start by introducing the different interaction patterns that SCA and Tuscany support. Then we’ll look at each pattern in more detail and explore the motivation, configuration, and applicability of each pattern.

We’ll demonstrate each SCA interaction pattern by using a component from the travel-booking application. We’re going to use the Hotel, Calendar, CurrencyConverter, and ShoppingCart components here. These components can be found in the following sample contributions, respectively:

  • contribution/hotel
  • contributions/calendar
  • contributions/currency
  • contributions/shoppingcart

4.1. Understanding the range of SCA service interaction patterns

4.2. Remote interaction

4.3. Local interaction

4.4. Request response interaction

4.5. One-way interaction

4.6. Callback interaction

4.7. Conversational interaction

4.8. Summary