• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Spring Integration

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team,

I have a requirement that I need to poll a particular location in windows or unix for the existence of a file and as and when a file comes then report the same with a success. If the file does not come within the stipulated time duration say 30 mins. then the program would return an error "Particular file was not found during the time interval".

I searched the net and figured out that we would be using Spring integration for the same. I am new to Spring integration.

Please if someone could guide me on how to solve my problem stmt.

Thanks and Regards,
Sid.
 
Marshal
Posts: 5925
400
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many many ways for you to solve your problem, none of which "require" you to use Spring. You can of course if you wanted to but it wouldn't necessarily help.

You don't even need Java. I could probably write a bash or Python script in an afternoon that would do this (others more savvy with scripting could probably do it in 10 minutes).
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:There are many many ways for you to solve your problem, none of which "require" you to use Spring. You can of course if you wanted to but it wouldn't necessarily help.

You don't even need Java. I could probably write a bash or Python script in an afternoon that would do this (others more savvy with scripting could probably do it in 10 minutes).



Thanks Tim but I would like to use Spring only. Would I need to use Spring integration for the same ? Please do let me know as to how to go about it.
 
Tim Cooke
Marshal
Posts: 5925
400
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Siddharth Bhargava wrote:I would like to use Spring only


Why?
 
Tim Cooke
Marshal
Posts: 5925
400
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll elaborate a little... What part of the problem are you hoping to solve with Spring?

"Spring integration" is not a thing. Those articles you found on the "net" were probably just talking about adding Spring into your application.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would just implement this as a Quartz job that polls the location at schedule intervals. I'm not very familiar with Spring Integration. I don't know if it provides a better way
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:I would just implement this as a Quartz job that polls the location at schedule intervals. I'm not very familiar with Spring Integration. I don't know if it provides a better way



I understand that there might be many ways but we are using Spring and I found out that Spring integration is the way to go so wanted some inputs on the same as I am new in it.
 
Tim Cooke
Marshal
Posts: 5925
400
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Siddharth Bhargava wrote:... we are using Spring ...


Would I be assuming correctly if I took from this that you are writing a new feature for an existing application that uses Spring?

Regardless, I have a number of quesitons:
  • Polling: How often?
  • Report success: How? UI output? Return value? Log message? DB call? Remote call?
  • Report error: How? UI? Return value? Log? DB? Remote? Exception? System exit?

  • I still maintain that "Spring Integration" is not a thing. The Spring framework has a number of features that solve, or make easier, a number of problems but unfortunately in this instance I do not know what particular problem you are hoping to solve with it so cannot suggest how you would use it. To say you want to solve your problem with "Spring integration" just doesn't make sense as a sentence. Perhaps you can point us to the websites that you have found? That might at least help me understand what you think it will do for your application.

    Unless of course you're talking about this Spring-Integration project?? In which case you are about to massively over engineer your application for no good reason and I would recommend you leave it alone and go with something much simpler.
     
    Siddharth Bhargava
    Ranch Hand
    Posts: 280
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Tim Cooke wrote:

    Siddharth Bhargava wrote:... we are using Spring ...


    Would I be assuming correctly if I took from this that you are writing a new feature for an existing application that uses Spring?

    Regardless, I have a number of quesitons:
  • Polling: How often?
  • Report success: How? UI output? Return value? Log message? DB call? Remote call?
  • Report error: How? UI? Return value? Log? DB? Remote? Exception? System exit?

  • I still maintain that "Spring Integration" is not a thing. The Spring framework has a number of features that solve, or make easier, a number of problems but unfortunately in this instance I do not know what particular problem you are hoping to solve with it so cannot suggest how you would use it. To say you want to solve your problem with "Spring integration" just doesn't make sense as a sentence. Perhaps you can point us to the websites that you have found? That might at least help me understand what you think it will do for your application.

    Unless of course you're talking about this Spring-Integration project?? In which case you are about to massively over engineer your application for no good reason and I would recommend you leave it alone and go with something much simpler.



    Hi Tim,

    You are correct. I am indeed writing a new feature for an existing application that uses Spring.

    Here are the answers to your queries:
  • Polling: How often?
  • : Well this is configurable. Currently its value is 5 seconds.
  • Report success: How? UI output? Return value? Log message? DB call? Remote call?
  • : Success would reported by Logging (Log message).
  • Report error: How? UI? Return value? Log? DB? Remote? Exception? System exit?
  • : Error would also be reported by Logging (Log message).

    I understand that "Spring integration" is not a thing. Again I would like to re-iterate that I would like to solve my problem using "Spring Integration" as it fits into my requirements and would solve my problem in a much easier and cleaner way. Also its my requirement and my organisation has asked me to do using "Spring integration". I would like to solve my whole issue using "Spring Integration"which is - to poll a given location (in say an interval of 5 sec.) for a file (with a given pattern) and then do some processing on the file - say copy the file to another location. Following are some of the URLs (websites) which I have searched for the same:

    http://java.dzone.com/articles/getting-started-spring-0
    https://thinkbiganalytics.com/ingestion-with-spring-integration/
    http://java-success.blogspot.in/2013/01/spring-integration-polling-for-file-and.html
    http://www.javacodegeeks.com/2013/05/spring-integration-file-polling-and-tests.html
    http://stackoverflow.com/questions/14171283/spring-integration-file-reading-the-file-by-inbound-channel-adapter-before-it
    http://docs.spring.io/spring-integration/docs/4.0.0.RELEASE/reference/html/files.html


    Waiting for your reply and thoughts.

    Thanks and Regards,
    Sid.
     
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Siddharth,

    Indeed, Spring Integration will give you a clean solution for that part of your system (polling for files).

    Reading those links you gave would be very helpful.

    Look for a simple file-polling example and understand it fully.

    A good reference is the Spring Integration in Action book.
     
    Siddharth Bhargava
    Ranch Hand
    Posts: 280
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Jesus Angeles wrote:Hi Siddharth,

    Indeed, Spring Integration will give you a clean solution for that part of your system (polling for files).

    Reading those links you gave would be very helpful.

    Look for a simple file-polling example and understand it fully.

    A good reference is the Spring Integration in Action book.



    Hi Jesus,

    Thanks for your reply. I understand that Spring Integration would give me a clean solution for my requirements.

    I read the links but I am not able to follow everything what is given in them. In fact I started writing a program but I am facing many many issues in the form of exceptions which I am not able to solve. I looked for a file polling example on the net but its doesn't seem to be working.

    Following is my xml configuration file:



    And following is the exception which I am getting and which I am unable to solve even by searching on the net.




    I would surely be purchasing the book "Spring Integration in Action" after some due practice in it.

    Please do help me in solving my exception.

    Thanks and Regards,
    Sid.
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The error suggests a jar is missing in your classpath.
     
    Siddharth Bhargava
    Ranch Hand
    Posts: 280
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Jesus Angeles wrote:The error suggests a jar is missing in your classpath.



    I tried to search for the error in the net but I am unable to find out which jar is missing.

    Its getting really frustrating.
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I normally use findjar.com or google to find out what jar it belongs to. Then check your classpath.
     
    Tim Cooke
    Marshal
    Posts: 5925
    400
    IntelliJ IDE Python TypeScript Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sid, I still don't think you need Spring Integration to solve your problem and I have been trying to suggest to you that you can achieve the same thing in a much simpler way. You are adding significant complexity where it is not needed.

    But... You are intent on using it, and I have no experience using it so I'm out. Good luck.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic