Announcement Announcement Module
No announcement yet.
Spring Integration 2.x REST Service Call Question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Integration 2.x REST Service Call Question

    So, I'm working on learning Spring Integration, and I'm hacking on the "quote" example.

    What I'd like to do is create a new version of the QuoteService that gets a real quote for a ticker.

    So, I built this:

    public class QuoteService {
    	@ServiceActivator(inputChannel = "tickers", outputChannel = "quotes")
    	public Quote lookupQuote(String ticker) {
    		String result = null;
    		try {
    			URL yahooUrl = new URL("" + ticker);
    			BufferedReader in = new BufferedReader(new InputStreamReader(yahooUrl.openStream()));
    			result = in.readLine();
    		} catch (IOException e) {
    		return (new Quote(ticker, new BigDecimal(result)));
    But I'd like to handle the call to the Yahoo service with Spring Integration, rather than having QuoteService have to be a class that invokes it explicitly. I see in the "ws" example how I might explicitly invoke a ws-style call, but I'm looking for an annotation-driven/bean driven way to do it, rather than using the Message API directly.

    I am just not quite getting what I could use that would let me adjust the URL parameters to include the input from the previous item in the chain.

    Any help would be appreciated!