Advertisement
Guest User

Untitled

a guest
May 19th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package camel.router;
  7.  
  8. import domain.Order;
  9. import domain.Sale;
  10. import org.apache.camel.Exchange;
  11. import org.apache.camel.builder.RouteBuilder;
  12. import org.apache.camel.model.dataformat.JsonLibrary;
  13.  
  14. /**
  15. *
  16. * @author silver-moon1412
  17. */
  18. public class RESTRMIBuilder extends RouteBuilder {
  19.  
  20. @Override
  21. public void configure() throws Exception {
  22.  
  23. from("imaps://outlook.office365.com?username=almhu390@student.otago.ac.nz"
  24. + "&password=hussain1992"
  25. + "&searchTerm.subject=Vend:SaleUpdate"
  26. + "&debugMode=false" // set to true if you want to see the authentication details
  27. + "&folderName=INBOX") // change to whatever folder your Vend messages end up in
  28. .convertBodyTo(String.class)
  29. .log("${body}")
  30. .unmarshal().json(JsonLibrary.Gson, Sale.class)
  31. .to("jms:queue:vend-new-sale");
  32.  
  33. from("jms:queue:vend-new-sale").log("${body}")
  34. .to("rmi://localhost:1099/sales?remoteInterfaces=aggregation.ISaleAggregation&method=newSale");
  35.  
  36.  
  37. from("imaps://outlook.office365.com?username=almhu390@student.otago.ac.nz"
  38. + "&password=hussain1992"
  39. + "&searchTerm.subject=Vend:InventoryUpdate"
  40. + "&debugMode=false" // set to true if you want to see the authentication details
  41. + "&folderName=INBOX") // change to whatever folder your Vend messages end up in
  42. .convertBodyTo(String.class)
  43. .log("${body}")
  44.  
  45.  
  46.  
  47. .removeHeaders("*")
  48. .setHeader(Exchange.HTTP_METHOD, constant("POST"))
  49. .setHeader(Exchange.CONTENT_TYPE, constant("text/xml"))
  50.  
  51. .unmarshal().json(JsonLibrary.Gson, Order.class).log("LOG HERE ******** : ${body}")
  52. .to("http4://localhost:8083/orders")
  53. .to("jms:queue:http-response");
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement