Announcement Announcement Module
No announcement yet.
http inbound channel adapter in spring mvc environment Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • http inbound channel adapter in spring mvc environment


    I have an application built with Spring ROO and I'm not sure of the best way to configure an http inbound channel adapter that will work alongside Spring MVC.

    In the SI docs, there is a note

    "If you are running within a Spring MVC application and using the BeanNameHandlerMapping, then the servlet definition is not necessary. In that case, the bean name for your gateway can be matched against the URL path just like a Spring MVC Controller bean."

    Can any point me towards the best configuration within Spring ROO.

    I'm using SI 1.0.4

    Last edited by JonHill; Aug 9th, 2010, 12:26 PM. Reason: typo

  • #2
    All I was missing was :

    <beans:bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" />
    I'm really getting this spring integration thing now! I can really see how it can support my application(s) bit-by-bit without much effort; all very nice.



    • #3
      Hi Jon,
      if you have a sample that you could post, it would be great.



      • #4
        My SI setup is quite minimal so far and consists of:

        Application A ( A Java application running as a background daemon process)
        Application B ( A Spring ROO Web application )

        Application A uses SI to put a message containing a serlialized POJO onto a queue channel. An http channel adapter polls the queue and relays the message over HTTP to application B. Any exceptions from the HTTP request (such as connection failures) are diverted to an error channel which is read by a service-activator where the messages can then be put back onto the queue for resending.

        The applicationContext-integration.xml file in my ROO application is very simple so far, the basics are:
        <channel id="myChannel" />
        <service-activator input-channel="myChannel" ref="myService"
        		method="myServiceMethod" />
        <beans:bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
        <beans:bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" />
        <http:inbound-channel-adapter id="httpEndpoint" name="/integration/httpEndpoint" channel="myChannel" supported-methods="POST" />
        Hope that helps.



        • #5
          Thanks Jon.
          I found another great example at:

          it is a bit long read, but it demonstrates both things I was looking for:
          1. inbound http gateway implemented through spring controller (controller populates POJO from requests and sends it to the channel through gateway)
          2. inbound http adapter (sends request map into channel), followed by transformer which converts it to the POJO.