Question

In order to prepare my 70-513 exam, I found the following question:

A Windows Communication Foundation (WCF) solution uses two services to manage a shopping cart. Service A processes messages containing line items that total between $0 and $500. Service B processes messages containing line items that total more than $500. All messages are of equal importance to the business logic. You need to route incoming messages to the appropriate services by using WCF routing. Which two message filters should you add to the router? (Each correct answer presents part of the solution. Choose two.)

  • A. a message filter with a priority of 100 that will forward messages that total between $0 and $500 to Service A
  • B. a message filter with a priority of 0 that will forward messages that total between $0 and $500 to Service A
  • C. a message filter with a priority of 0 that will forward all messages to Service B
  • D. a message filter with a priority of 100 that will forward all messages to Service B

The answer is A and C.

If A and C are the answer, why not B and D also be correct then? These two pairs are symmetric.

Was it helpful?

Solution

They are not symmetric.

A & C:

  • Filter1 -> 0-500 to ServiceA -> 100 priority
  • Filter2 -> All to ServiceB -> 0 priority

B & D

  • Filter1 -> 0-500 to ServiceA -> 0 priority
  • Filter2 -> All to ServiceB -> 100 priority

When a message is received by the router the message is subject to routing via all the filters which exists for that incoming message type.

This means the message content is evaluated against more than one filter, hence the need to establish priority in the case of conflicting filters.

The reason A&C is correct is that when the message is received two filters are available to evaluate the message content. If the message has a total line items = $300 for example, both filters will evaluate true against the content, but in this case we want to route this message to ServiceA, so we have to give Filter1 priority.

Does this help?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top