Skip to content

Commit

Permalink
Chapter 4 - After review
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Jun 7, 2017
1 parent 76d55ed commit 022ead9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Expand Up @@ -12,8 +12,8 @@ public class CustomerService {
* <p/>
* Notice that we can use any kind of Camel bean parameter binding, so we can bind the message @Body, @Header and so on.
*/
public boolean isGold(@JsonPath("$.order.customerId") int customerId) {
// its a gold customer if the customer id is < 1000
public boolean isGold(@JsonPath("$.order.loyaltyCode") int customerId) {
// its a gold customer if the loyalty code is < 1000
return customerId < 1000;
}

Expand All @@ -22,8 +22,8 @@ public boolean isGold(@JsonPath("$.order.customerId") int customerId) {
* <p/>
* Notice that we can use any kind of Camel bean parameter binding, so we can bind the message @Body, @Header and so on.
*/
public boolean isSilver(@JsonPath("$.order.customerId") int customerId) {
// its a silver customer if the customer id is between 1000 and 4999
public boolean isSilver(@JsonPath("$.order.loyaltyCode") int customerId) {
// its a silver customer if the loyalty code is between 1000 and 4999
return customerId >= 1000 && customerId < 5000;
}

Expand Down
Expand Up @@ -23,7 +23,7 @@ public void sendGoldOrder() throws Exception {
getMockEndpoint("mock:queue:regular").expectedMessageCount(0);

// prepare a JSon document from a String
String json = "{ \"order\": { \"customerId\": 88, \"item\": \"ActiveMQ in Action\" } }";
String json = "{ \"order\": { \"loyaltyCode\": 88, \"item\": \"ActiveMQ in Action\" } }";

// store the order as a file which is picked up by the route
template.sendBodyAndHeader("file://target/order", json, Exchange.FILE_NAME, "order.json");
Expand All @@ -38,7 +38,7 @@ public void sendSilverOrder() throws Exception {
getMockEndpoint("mock:queue:regular").expectedMessageCount(0);

// prepare a JSon document from a String
String json = "{ \"order\": { \"customerId\": 4444, \"item\": \"Camel in Action\" } }";
String json = "{ \"order\": { \"loyaltyCode\": 4444, \"item\": \"Camel in Action\" } }";

// store the order as a file which is picked up by the route
template.sendBodyAndHeader("file://target/order", json, Exchange.FILE_NAME, "order.json");
Expand Down
Expand Up @@ -29,7 +29,7 @@ public void sendGoldOrder() throws Exception {
getMockEndpoint("mock:queue:regular").expectedMessageCount(0);

// prepare a JSon document from a String
String json = "{ \"order\": { \"customerId\": 88, \"item\": \"ActiveMQ in Action\" } }";
String json = "{ \"order\": { \"loyaltyCode\": 88, \"item\": \"ActiveMQ in Action\" } }";

// store the order as a file which is picked up by the route
template.sendBodyAndHeader("file://target/order", json, Exchange.FILE_NAME, "order.json");
Expand All @@ -44,7 +44,7 @@ public void sendSilverOrder() throws Exception {
getMockEndpoint("mock:queue:regular").expectedMessageCount(0);

// prepare a JSon document from a String
String json = "{ \"order\": { \"customerId\": 4444, \"item\": \"Camel in Action\" } }";
String json = "{ \"order\": { \"loyaltyCode\": 4444, \"item\": \"Camel in Action\" } }";

// store the order as a file which is picked up by the route
template.sendBodyAndHeader("file://target/order", json, Exchange.FILE_NAME, "order.json");
Expand Down

0 comments on commit 022ead9

Please sign in to comment.