Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration Webservice vs. RestTemplate

Tags:

spring

I'm trying to learn SI (Spring Integration) but i'm a bit confused on the real usage of this.

As first example i would like to interact with a WebService but i dont understand what could be the difference from

  • Invoke a WebService Using SI
  • Invoke a Webservice using RestTemplate

So, what is the benefit of using SI (in Webservice context, or in other context)?

Looking the web, i havent find an article that explain:

  • Usually you will do in this way....
  • With SI you can do better - in this another way - and the benefit are....

To be more explicit on what i have to realize, this is an example:

1) I have to write an application (Standalone application) that have to collect some data in the system periodically and then invoke a Web Service that will store it.

2) The Web Service receive the call from the "clients" and store in the database.

My webservice will use REST.

The reason because i've think to use SI is that the Standalone Application should interact with different system

  • Webservice in first instance
  • A Web Mail, if the webservice is not achievable
  • File system if Web mail is not achievable too
like image 437
Mistre83 Avatar asked Feb 17 '26 01:02

Mistre83


1 Answers

If you only need to pull some data in a simple way and push it onwards to a REST service this does not "justify" the use of Spring Integration. A simple Spring (Boot) application combined with a scheduler will be sufficient.

But if you want to use a more complex data source for which an endpoint is available, you need transformations, complex and flexible routing is a high priority or even Enterprise Integration Patterns (EIP) then Spring Integration is for you. Have a look at the Overview and decide if it mentions something you consider as valuable to you. Perhaps you will create additional value by mixing in Spring Batch if you need to process a lot of data.

But as I understand your current demand starting with just a RESTTemplate should do for the moment. Starting small will not prevent you from switching to Spring Integration later on. Have a look at the various tutorials and guides provided by the Spring Boot project. There is even an example for Spring Integration.

like image 101
Marged Avatar answered Feb 18 '26 21:02

Marged