Spring Batch shall wait for service to get back online - web-services

I have a Spring Batch application which receives a CSV file and writes to a webservice.
I am looking for a way to pause the batch execution if the webservice is offline and resume it when it's back on.
Have anyone run into the same situation? Any advice is much appreciated.
Thanks

Related

Start a BPM process from the ESB (WSO2-Enterprise Integrator 6.4.0)

I would like to understand which in the best practice in wso2 to start a bpm process from the esb.
Basically I would need to define a service that starts a bpm process as soon as it receives an amqp message.
For the implementation of the service, I am refering to this https://docs.wso2.com/display/ESB490/ESB+as+a+RabbitMQ+Message+Consumer
that works as expected.
Now I am wondering which is the best practice to start the bpmn process from the ESB. Personally I would use an HTTPEndPoint to send the ReST POST "Start a Process Instance" (refer to https://docs.wso2.com/display/EI640/BPMN+REST+API#BPMNRESTAPI-Processinstances).
Is it this the expected approach or is there a better integrated way?
Your suggested approach is correct. BPMN process can be started using a REST call to the BPMN Rest api. Then the respective process will start and initiate a process instance. Make sure to send the correct data to the start resource.
[1] https://docs.wso2.com/display/EI6xx/BPMN+REST+API#BPMNRESTAPI-StartaProcessInstance
Regards
Nandika

Running Code every 11 seconds

I'm am new to server technology and dont really understand how they work (hope you could shed some light on this as well).
But basically my problem is I have a Firebase Database which i need to update every 20 seconds the whole day. This is the way I think i should solve the problem. I need to send a HTTP POST request to the firebase database every 20 sec. This means I need to have a server where I run a piece of code sending the HTTP request every 20s. Im not sure if this is the right way to do it, and even if it is how to implement it.
Some questions i have are
I definitely need to create a server for this right? and if so what platform is recommended to write my server code? (preferable free platforms)
I have tried reading up on the platforms available such as AWS, Google Cloud but dont really get the terminology used. Are there any tutorials for this available?
I am really lost, and have been stuck on this for some time, any help is deeply appreciated.
This is achievable by leveraging Cloud Watch Events specifically using a Rate Expression that invokes a SNS topic which can then hit your HTTP endpoint.
Hope that helps!
I would suggest that you try and keep everything within Firebase. Create a firebase cloud function that sends the HTTP request for the update, and use Firebase functions-cron that is a cron like scheduler to schedule.

Django+celery: how to show worker logs on the web server

I'm using Django+celery for my 1st ever web development project, and rabbitmq as the broker. My celery workers are running on a different system from the web server and are executing long-running tasks. During the task execution, the task output will be dumped to local log files on the workers. I'd like to display these task log files through the web server so the user can know in real-time where the execution is, but I've no idea how I should transfer these log files between the workers and the system where the web server is. Any suggestion is appreciated.
Do not move logs, just log to the same place. It can be really any database (relational or non-relational) accessible from the web server and Celery workers. You can even create (or look for) appropriate python logging handler, saving log records to the centralized storage.
Maybe the solution isn't to move the logs, but to aggregate them. Take a look at some logging tools like splunk, loggly or logscape.

Automatically restart Coldfusion service when it goes down [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to restart Coldfusion Application Server when application is timeout?
Currently I have an ColdFusion application that causes server issues. After 1-2 days that serve doesn't respond until a manual restart is done.
I know that I had to find what is going wrong in my scripts and I spend time and time for several weeks.
But pending I would make a script that restart automatically ColdFusion service if it is bugged.
I have not many knowledge in batch script etc.. but I guess that the test would be a request to a .cfm and the response would be serve until a timeout. ?
Has anyone ever met a script like this ?
Config: Win 2k8 Server R2 - Coldfusion 9(.0.0)
Thank you
Two things here
The real way is to fix the issue and you can do that with Fusion Reactor - http://www.fusion-reactor.com/fr/ It will help you monitor and restart and self heal as it needs.
You could create a batch file, and create a Scheduled Task in Windows that ran it.
Using Net Start / Net Stop Commands
net stop "Macromedia JRun CFusion Server"
net start "Macromedia JRun CFusion Server"
Thought this may not always work so I have a batch file:
c:\JRun4\uninstall\KillJRun.exe
net start "Macromedia JRun CFusion Server"
Which works for me.
Your best bet is to use Pingdom or another server monitoring tool. When the server goes down (responds with a 503 error, service unavailable) you may be able to have Pingdom send a response to a PHP script on the server that calls a batch file. I am not sure if Pingdom supports pinging another server is one is down, but you could have Pingdom email to an inbox that your PHP can check every few minutes.
This may end up being more work than figuring out what is wrong with your script though.
Edit: You may want to look at this question. This will only work if the service has stopped, whereas usually when a script crashes ColdFusion it is hanging. If you run the script that crashes the server, then look at the service, if it says stopped, then this may work for you.
The other thing that I would check is the JVM memory. Often times crashes are due to processing large amounts of data from files or the database and the JVM doesn't have the memory to do that.
Nope. It cannot be restart automatically when your CF services/server is hanging. The only one way is to restart by windows schedule.
You could also use Nagios+Plugins to fire a restart script when the service hangs. But following the previous advice & finding out what the problem is is your best bet.

Monitor Coldfusion on linux with monit?

We are trying to use monit to monitor services on our Ubuntu machine. I have successfully setup a host url check to make sure that coldfusion can render web pages and it there is an error to restart coldfusion.
I was wondering if there is a way to get more stats into monit by monitoring the coldfusion process. I have been unable to find out if coldfusion creates a pid file.
Does Coldfusion 9 or Jrun create a pid file for monit to use? Is there another way to monitor coldfusion with monit?
ColdFusion can output real-time performance metrics such as:
Page hits per second
Database accesses per second
Number of queued requests
Number of running requests
Number of timed out requests
Average queue time
Average request time
Average database transaction time
Bytes incoming per second
Bytes outgoing per second
You can learn more about the output of this logging here: http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf3638e6-7fe0.html#WS9F365555-357A-4a15-AC72-449EF611E342
I would be interested to learn how you set this up once complete. I'll have the same task in a few weeks.
Thanks!
You will need to create the PID file with a wrapper script around your Java application. I'm doing the same thing myself these days. To the best of my understanding monit has to have the PID file to check the life of your service.