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
Explanation:
Message FiltersTo implement content-based routing, the Routing Service uses MessageFilter implementations
that inspect specific sections of a message, such as the address, endpoint name, or a specific XPath statement.
If none of the message filters provided with .NET Framework 4 meet your needs,
you can create a custom filter by creating a new implementation of the base MessageFilter class.When configuring the Routing Service, you must define filter elements (FilterElement objects) that describe
the type of MessageFilter and any supporting data required to create the filter, such as specific string values
to search for within the message. Note that creating the filter elements only defines the individual message filters;
to use the filters to evaluate and route messages you must also define a filter table (FilterTableEntryCollection).Each entry in the filter table references a filter element and specifies the client endpoint that a message will be routed
to if the message matches the filter. The filter table entries also allow you to specify a collection of backup endpoints (BackupEndpointCollection),
which defines a list of endpoints that the message will be transmitted to in the event of a transmission failure when sending to the primary endpoint.
These endpoints will be tried in the order specified until one succeeds.Priority is applied from hight to low.
Routing Service
(http://msdn.microsoft.com/en-us/library/ee517423.aspx)RoutingIntroduction
(http://msdn.microsoft.com/en-us/library/ee517422.aspx)Message Filters
(http://msdn.microsoft.com/en-us/library/ee517424.aspx)EXAMPLE:
<behaviors>
<serviceBehaviors>
<behavior name=”routingData”>
<serviceMetadata httpGetEnabled=”True”/>
<!– Add the RoutingBehavior and specify the Routing Table to use –>
<routing filterTableName=”routingTable1″ />
</behavior>
</serviceBehaviors>
</behaviors>
<!–ROUTING SECTION –>
<routing>
<filters>
<filter name=”MatchAllFilter1″ filterType=”MatchAll” />
<filter name=”RoundingFilter1″ filterType=”EndpointAddress”
filterData=”http://localhost:8000/routingservice/router/rounding” />
</filters>
<filterTables>
<table name=”routingTable1″>
<filters>
<add filterName=”MatchAllFilter1″ endpointName=”CalculatorService” />
<add filterName=”RoundingFilter1″ endpointName=”RoundingCalcService” />
</filters>
</table>
</filterTables>
</routing>
AC