I need to pass information from a shell script (called from a linux based app) to a java application.
Named pipes are a pain because I can't start/stop either service without considering complex repercussions to the read/write ends of the pipes.
Sockets are tough because if the listening process is restarted there's no queuing mechanism, and simple implementations require new sockets be constantly created (else the shell script will get very complex with check-and-restart-socket, and queuing code).
I was recently reading about these System V/POSIX linux message queues. I'm running Fedora 12, and wonder if there's a good way to configure these message queues and interact with them from Java.
You can't use them directly, you'd have to do some JNI wizardry to interface them together.
What problems are you having with Pipes? Java sees those as just generic files. I haven't used them extensively, but I didn't have any real problems with Pipes. The only detail there was the pipe reader needs to continually reopen the pipe if the producers can't keep up.
But if either side fails, the other side just blocks waiting for the other to recover.
You just have to be careful with buffer reads from the pipe. If you read from the pipe in to a buffer, and then fail, that data is lost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With