Created
May 4, 2016 13:38
-
-
Save logentries-gists/9fc00b458705aa17742975acb107f4f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * sends batch job to a queue for further processing. | |
| * | |
| * @param job | |
| * task that will be serialized and sent to queue | |
| * @return true if job has been successfully queued | |
| */ | |
| public boolean sendJobToWaitQueue(Batch job) { | |
| LOGGER.debug("Trying to push job to queue: " + job.toString()); | |
| String jobJson = batchToJson(job); | |
| Jedis instance = null; | |
| try { | |
| instance = this.jedisPool.getResource(); | |
| // left push to a wait queue | |
| instance.lpush(waitQueue, jobJson); | |
| LOGGER.debug("Job successfully published to channel {} {}", waitQueue, jobJson); | |
| return true; | |
| } catch (Exception e) { | |
| LOGGER.error("Problem while publishing message to a channel", e); | |
| return false; | |
| } finally { | |
| instance.close(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment