Hey Dotan,

You can shutdown the container by calling coordinator.shutdown.

To shutdown via JMX, you'd have to have your StreamTask expose a `Boolean
shutdown` variable via JMX. Then, in process(), you'd just check if
shutdown=true, and call coordinator.shutdown. If you go this route, the
SamzaContainer will log its JMX connection information in the Log4J logs,
like so:

17:32:19,199  INFO JmxServer:128 - Started JmxServer registry port=33957
server port=33958 
url=service:jmx:rmi://localhost:33958/jndi/rmi://localhost:33957/jmxrmi
17:32:19,201  INFO JmxServer:128 - If you are tunneling, you might want to
try JmxServer registry port=33957 server port=33958
url=service:jmx:rmi://some-host:33958/jndi/rmi://eat1-app587.corp:33957/jmx
rmi

You can use this information to connect via VisualVM or JConsole, and
trigger the Mbean.


An alternative shutdown style, which I'd recommend, is to use a control
stream. I'm going to assume you're using Kafka. If so, you can create
something like a "my-job-control-stream" topic. Your job should then be
configured to read from this stream. You can then send the topic a message
using kafka-console-producer.sh, and code your StreamTask to call
coordinator.shutdown anytime it receives a message from the stream.

Either of these approaches should work.

Cheers,
Chris

On 7/14/14 2:38 AM, "Dotan Patrich" <[email protected]> wrote:

>Hi,
>
>I'm trying to run a samza task using LocalJobFactory with a task that
>implements ClosableTask interface.
>One thing that I cannot figure out is how to gracefully shutdown the task
>container and call the close method?
>Is there some operation that does that and can be called using JMX?
>
>Thanks,
>Dotan

Reply via email to