Spring package and integration

I am new to Spring and I need to do a project for school. What project can I do, what can I use Spring Package and integration. I know that I can write files in a directory, write, read and edit files, separated by commas, but I can not imagine a scenario with which I can combine these technologies.

+6
java spring spring-batch spring-integration
source share
4 answers

I am not an expert on Spring or Spring batch or Spring integration myself, but I can tell you the practical task that I had to do in my organization in order to use all these requirements for the requirement.

My company takes a credit card from our customers when they sign up and charge them every 30 days. Therefore, every day we must see who is on the 30th day, and authorize our service to them, charging them. Therefore, I have to send data to banks daily.

Step: 1 I had to write a program to receive customer credit card information that should have been sent that day from our secure database through a batch program, and write this content in a specific format that the bank wants in a temporary place on our company server as a ".txt" file (for example: /user/someuser/endofdaytransaction/dd-mm-yyyy.txt)

Step: 2 . As soon as the contents (dd-mm-yyyy.txt) are available in this directory (/ user / oneworld / endofdaytransaction /), I have to connect to the SFTP server server and transfer the file to the directory that the bank provided us with.

I use Spring Batch for Step: 1, the batch job runs through the Quartz scheduler every day at 5 pm and Spring Integration for step: 2, to continue polling the directory and once the file is found, transfer it to the bank.

I also see from Spring docs that I can mashup these technologies, that is, I can avoid writing to a temporary directory and ask Spring Integration to write directly to the bank’s SFTP server.

Another practical example that I could think of: I have AT&T and signed up for Auto Payment, that is, they bill me every 30 days and keep my Internet and phone service active. I have provided AT&T information about my credit card. They combine all the credit cards (subscribers) that will be billed, and send the data to VISA or MASTERCARD, which every day must specify a batch file at a specific time. I hope you can talk about step 1 and step 2, which I spoke about. Happy learning!

+4
source share

but I can’t imagine a scenario with which I can combine these technologies

Well, let's take a fairly large company that needs a lot of batchjobs with spring integration, you can configure the system to

  • manage batchjobs
  • Schedule tasks according to resources (for example, run a batchjob in certain time windows so as not to interrupt the online business).
  • just start / stop tasks
  • provide job status representations

actually its just

  • Planning
  • reporting
  • control

through many corporate message concepts see http://www.eaipatterns.com/ its already linked at http://www.springsource.org/spring-integration

for your scope, a school project - and if you really have some tasks (3 or more), you can create a batch launch tool, a graphical interface (spring mvc), which provides buttons for starting / stopping / monitoring / cm. reports for these assignments, but I think this is a really big project that can easily cover many person-weeks

+3
source share

There is a great example of integrating two (non-pun intended) ones from SpringSource blogger Dave Sieer: PRACTICAL USE OF SPRING BATCH AND SPRING INTEGRATION

+2
source share

Imagine, for a moment, that you are building a wellness system for organizing medical care (HMO). Such a system may have the following requirements:

  • For patients who have not passed the wellness exam during the year, send an email and / or text message, reminding them that they need an examination.

  • To encourage patients to take wellness exams, allow them to “respond” to an e-mail or text message that notifies the registrar of an appointment.

  • For patients with chronic conditions who require regular visits, send them an e-mail or write them.

  • Take care of patients every week until they receive their blown-up examination, but for the love of sanity, no more often than that.

Obviously, such a wellness system will have a database for tracking patients, which may have such a table:

CREATE TABLE patient ( patient_id INTEGER, first_name VARCHAR2(255) NOT NULL, last_name VARCHAR2(255) NOT NULL, last_checkup_date DATE, follow_up_days INTEGER email_address VARCHAR2(255), mobile_nbr VARCHAR2(255), last_notify_date DATE, PRIMARY KEY(patient_id) ); 

For text messages, this is an ideal case for JMS. You can use HornetQ, RabbitMQ, ActiveMQ or many others.

Now stop for a moment and think about all the code you would have to write if you did this in direct Java. For the requirements I just mentioned, you can write this application without a single line of Java code.

0
source share

All Articles