Announcement Announcement Module
Collapse
No announcement yet.
Need help getting started with SI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help getting started with SI

    I am currently attempting a PoC with Spring Integration and having some trouble getting starting.

    This PoC will consist of the following steps

    1. receive a Cart object via HTTP
    2. Call web service to get a tracking number
    3. write Cart to the database.

    This is a very simplistic case, but it will be expanding to send the order to an ERP system for processing, sending email notifications, etc.

    I am having trouble with how to update the cart with the tracking number results after they have been returned. The config below does output the result of the web service call with just a log statement.

    Here is my config xml file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:mail="http://www.springframework.org/schema/integration/mail"
    	xmlns:int-event="http://www.springframework.org/schema/integration/event"
    	xmlns:int-http="http://www.springframework.org/schema/integration/http"
    	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xsi:schemaLocation="http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.1.xsd
    		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
    		http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.1.xsd
    		http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
    		http://www.springframework.org/schema/integration/event http://www.springframework.org/schema/integration/event/spring-integration-event-2.1.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    
    	<!-- Gateway that publishes signed up messages -->
    	<gateway 
    		id="orderGateway" 
    		service-interface="order.OrderGateway" 
    		default-request-channel="trackingChannel" />
    	
    	<channel id="trackingChannel" />
    
    	<int-http:outbound-gateway id="trackingHttpOutbound"
    		request-channel="trackingChannel" 
    		url="http://localhost:8080/tracking/getNextTrackingNumber"
    		http-method="GET"
    		expected-response-type="tracking.Response"
    		reply-channel="defaultMessageHandlerChannel">
    		
    	</int-http:outbound-gateway>
    
    	<service-activator input-channel="defaultMessageHandlerChannel" ref="defaultMessageHandler" method="handleMessage" />
    	
    </beans:beans>
    I want to start out with implementing this in a junit test, but I am not sure how to test this. Here is a first attempt that doesn't do much.
    Code:
    	@Test
    	public void testPlaceOrder() {
    		log.info( "testPlaceOrder : enter" );
    		
    		Cart cart = new Cart();
    		cart.setUid( "test" );
    
    		gateway.placeOrder( cart );
    		
    		log.info( "testPlaceOrder : exit" );
    	}
    I appreciate any help in understanding this.

  • #2
    I'd suggest start here https://github.com/SpringSource/spri...sting-examples
    There are some nice testing examples.
    Let us know once you get through them if you have more questions.

    Comment


    • #3
      thanks. I will take a look them. are any of them somewhat similar to what I described that I should look into first? I will pull them down and start reading through them.

      Comment

      Working...
      X