1 Reply Latest reply on Jun 12, 2014 1:41 AM by Tomohisa igarashi

    Not getting Subject,to and from while fetching mail using switchyard

    sumit kadian Newbie

      Hi I am trying to fetch the mail using switchyard. but I am only getting mail body in the logs.

      But I also required the Subject, to and from in the logs.

       

      Below is my route.xml

      ----------------------------------------------------------------------------------------------------------------------------------

      <?xml version="1.0" encoding="ASCII"?>

      <routes xmlns="http://camel.apache.org/schema/spring">

          <route>

              <from uri="switchyard://PrintService"/>

              <log message="PrintService - message received: ${body}"/>

              <to uri="log:before?showHeaders=true"/>

              <log message="PrintService - message received: ${body}" loggingLevel="DEBUG"/>

              <split>

                  <tokenize token="\n"></tokenize>

                  <choice>

                      <when>

                          <simple>${in.body} contains 'Number of days'</simple>

                          <split>

                              <tokenize token=":-"></tokenize>

                              <choice>

                                  <when>

                                      <simple>${in.body} contains 'Number of days'</simple>

                                      <log message="PrintService - Number of days received: ${body}"/>

                                  </when>

                                  <otherwise>

                                      <to uri="sql:insert into Leaveof(days) values(#)?dataSourceRef=jboss/sumit"/>

                                      <log message="PrintService - Number of days sumit received: ${body}"/>

                                  </otherwise>

                              </choice>

                          </split>

                      </when>

                      <when>

                          <simple>${in.body} contains 'Start Date'</simple>

                          <split>

                              <tokenize token=":-"></tokenize>

                              <choice>

                                  <when>

                                      <simple>${in.body} contains 'Start Date'</simple>

                                      <log message="PrintService - Number of days received: ${body}"/>

                                  </when>

                                  <otherwise>

                                      <convertBodyTo type="java.lang.String"/>

                                      <to uri="sql:insert into Leaveof(start_date) values(#)?dataSourceRef=jboss/sumit"/>

                                      <log message="PrintService - Number of days start_date received: ${body}"/>

                                  </otherwise>

                              </choice>

                          </split>

                      </when>

                  </choice>

              </split>

          </route>

      </routes>

       

       

      ----------------------------------------------------------------------------------