title: How to Unmarshall XML from JMS queue Using spring integration dsl
body: <p>Since i do no have enough reputation to comment on the other topic open about this </p>
  
  <p>(<a href="https://stackoverflow.com/questions/49734473/how-to-unmarshall-xml-using-spring-integration-dsl">How to unmarshall xml using spring integration dsl</a>)</p>
  
  <p>I had to create a new topic in order to ask my question.
  I have a JMS which polls XML messages from a queue, and i want to transform those messages into Java Objects.
  Here is the code i have written</p>
  
  <pre><code>@Bean
  public IntegrationFlow jmsMessageDrivenRedeliveryFlow() {
      return IntegrationFlows
              .from(Jms.messageDrivenChannelAdapter(new ActiveMQConnectionFactory("tcp://localhost:61616"))
                      .errorChannel(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)
                      .destination("foo.bar").jmsMessageConverter(new MarshallingMessageConverter(jaxbMarshaller())))
              .handle(m -&gt; System.out.println(m.getName())).get();
  }
  
  @Bean
  public Marshaller jaxbMarshaller() {
      Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
      return jaxb2Marshaller;
  }
  </code></pre>
  
  <p>The class that i want to Create from XML is Customer class with the following structure</p>
  
  <pre><code>@XmlRootElement
  public class Customer {
  
      String name;
      int age;
      int id;
  
      public String getName() {
          return name;
      }
  
      @XmlElement
      public void setName(String name) {
          this.name = name;
      }
  
      public int getAge() {
          return age;
      }
  
      @XmlElement
      public void setAge(int age) {
          this.age = age;
      }
  
      public int getId() {
          return id;
      }
  
      @XmlAttribute
      public void setId(int id) {
          this.id = id;
      }
  
  }
  </code></pre>
  
  <p>Based on the answers on the other thread, how can i configure the Marshaller to return a Customer object?
  Thanks a lot in advance.</p>