Package net.greghaines.jesque.worker

Examples of net.greghaines.jesque.worker.WorkerListener


        changeRedisTimeout(10);
        TestUtils.enqueueJobs("longRunning", Arrays.asList(new Job("LongRunningAction", 20 * 1000L)), config);
        final Worker worker2 = new WorkerImpl(config, Arrays.asList("longRunning"),
                new MapBasedJobFactory(map(entry("LongRunningAction", LongRunningAction.class))));
        final AtomicBoolean successRef = new AtomicBoolean(false);
        worker2.getWorkerEventEmitter().addListener(new WorkerListener() {
            @Override
            public void onEvent(final WorkerEvent event, final Worker worker, final String queue, final Job job,
                    final Object runner, final Object result, final Throwable t) {
                successRef.set(true);
                log.info("SUCCCESS: {}", job);
View Full Code Here


    @Test
    public void unpermittedJob() {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
        final AtomicBoolean didFailWithUnpermittedJob = new AtomicBoolean(false);
        doWork(Arrays.asList(job), map(entry("FailAction", FailAction.class)), new WorkerListener() {
            public void onEvent(final WorkerEvent event, final Worker worker, final String queue, final Job job,
                    final Object runner, final Object result, final Throwable t) {
                if (JOB_FAILURE.equals(event) && (t instanceof UnpermittedJobException)) {
                    didFailWithUnpermittedJob.set(true);
                }
View Full Code Here

TOP

Related Classes of net.greghaines.jesque.worker.WorkerListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.