Listener(Client) coding and running all the time

Listener(Client) coding and running all the time

Postby djakkulaspoton » Thu Jul 21, 2016 12:15 am

Greetings, I am new to Python. I need to setup a MQ Listener( I have Host, Port and required certs installed on client).
1. Can you give me a sample Listener code(on Linix OS),
This Listener, Listens to a port(on MQ Server) for a message(volume of messages - max 10,000 per day).
When message comes it will parse the message and update MySQL table with the data from parsed message. ( I found a documentation on how to connect
MySQL and insert/update entries.)

2. In the Listener code, can we limit connections to MQ(server) and MySQL(database).

3. How can we schedule the Listener to run continuously and send email when it fails/got killed/terminated.

4. How can we setup auto restart when server restarts for scheduled maintenance.

5. Is there any risk of loosing processing message/data when doing auto restart or when listener got killed. How do we know.

Thank you for your help...
Last edited by Yoriz on Thu Jul 21, 2016 5:18 am, edited 1 time in total.
Reason: First post lock.
Posts: 1
Joined: Wed Jul 20, 2016 11:58 pm

Re: Listener(Client) coding and running all the time

Postby Ofnuts » Thu Jul 21, 2016 1:06 pm

1) I assume you mean Linux?

2) Since you are using a DB, it is not difficult to keep the count of processed requests in a table (or maybe even in a sequence) and check that the count is below 10000, and if not so return an error. If it's a rolling 24-hours period, then you have to keep the time stamps of the requests, and count the time stamps that are more recent than "now" minus 24H, but this isn't hard either.

3) Nothing to do with Python, plenty of ways to start processes on startup or periodically in a Linux system, but these depends on Linux "flavor". ask your local Linux guru. To check that your process runs you can have another process started peridovally and checking that you process is still alive.

4) See 3)

5) Ensuring that nothing is lost is normally the purpose of using this kind of messaging protocol.
This forum has been moved to See you there.
User avatar
Posts: 2659
Joined: Thu May 14, 2015 9:46 am
Location: Paris, France, EU, Earth, Solar system, Milky Way, Local Cluster, Universe #32987440940987

Return to Networking

Who is online

Users browsing this forum: No registered users and 2 guests