Skip to content

Instantly share code, notes, and snippets.

@vadimii
Last active August 29, 2015 14:04
Show Gist options
  • Save vadimii/906b43f2afb771820461 to your computer and use it in GitHub Desktop.
Save vadimii/906b43f2afb771820461 to your computer and use it in GitHub Desktop.
Celery tasks chain from groovy
def sendThenApproveOrder(orderId, dateString) {
def config = grailsApplication.config
def refkey = config.co.mias.forms.services.refkey.toString()
def message = [
'args': [refkey, orderId, dateString],
'task': 'milery.task.order.send_new_order',
'id': randomUUID() as String,
'callbacks': [
[
'immutable': true,
'args': [refkey, orderId, dateString],
'task': 'milery.task.order.approve_order',
'id': randomUUID() as String,
'options': [:]
]
]
] as JSON
messageService.send(message.toString())
log.info 'sendThenApproveOrder: ' + orderId + ', ' + dateString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment