Announcement Announcement Module
Collapse
No announcement yet.
Sending requests to Spring WS multiple times. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending requests to Spring WS multiple times.

    Hi, I tried to upgrade my application from RC2 to 1.0.0. and Im having a problem. Basically my application works this way: I send a request to Spring WS multiple times and the response of Spring WS is sent to service-activator to process this response and print them to the console. The coding below works perfectly fine with RC2 interms of polling the requests at correct time interval but on the other hand with 1.0.0 the requests r not polled with correct time interval.I c my console keeps on printing responses continuously without any time interval one after another.Im using 1.5.5 for Spring WS.What did I do wrong??

    The following are the codings for both the versions of SI
    Code:
    <!--Polling requests and sent to Spring WS-->
    <inbound-channel-adapter ref="source" method="sendRequest" channel="requestChannel">
    <poller>
        <interval-trigger interval="75" time-unit="SECONDS" fixed-rate="true" initial-delay="10"/>
    </poller>
      </inbound-channel-adapter>
    <beans:bean id="source" class="integrationGID.RequestSender"/>
     
    <!--Sending WebService request to fetch data-->
    <ws:outbound-gateway id="gateway"
    				         request-channel="requestChannel" 
    				         reply-channel="responseChannel"
    				         uri="http://localhost:8080/Spring_WS_GID/"/>
    
    <!--Processes the response frm Spring WS -->
    <service-activator input-channel="responseChannel" output-channel="RoutingChannel" ref="changeChecker" method="receive" />
    	<beans:bean id="changeChecker" class="integrationGID.ChangeChecker"/>
    	
    
    <stream:stdout-channel-adapter id="RoutingChannel"/>
    </beans:beans>

    RequestSender.java
    Code:
    public class RequestSender {
    	
    	public Message<String> sendRequest(){
    		
    
    		String requestXml =
    			"<divisionRequest xmlns=\"http://gid.com/div/schemas\">FETCHDATA</divisionRequest>" ;
    	Message<String> message = MessageBuilder.withPayload(requestXml)
    		.setHeader("http://gid.com/div/schemas",requestXml)
    		.build();
    			return message;
    	}
    
    }

  • #2
    The fix for this is easy add max-message-per-poll="1" to your poller element.

    The default behaviour of the poller is to poll once per interval and where a non null value is returned the poller then polls again immediately. This is designed for the we want to poll the file system periodically and process all files we find type scenario. The default max-messages-per-poll is unlimited so it will keep polling for as long your class does not return null.

    As to why this was this worked in RC2 I am not sure. I will take a look when I get some time.

    Comment

    Working...
    X