def TaskMessage(name, id=None, args=(), kwargs={}, callbacks=None, errbacks=None, chain=None, shadow=None, utc=None, **options):
 from celery import uuid
 from kombu.serialization import dumps
 id = (id or uuid())
 message = Mock(name=u'TaskMessage-{0}'.format(id))
 message.headers = {u'id': id, u'task': name, u'shadow': shadow}
 embed = {u'callbacks': callbacks, u'errbacks': errbacks, u'chain': chain}
 message.headers.update(options)
 (message.content_type, message.content_encoding, message.body) = dumps((args, kwargs, embed), serializer=u'json')
 message.payload = (args, kwargs, embed)
 return message

def TaskMessage ( name , id = None , args = ( ) , kwargs = { } , callbacks = None , errbacks = None , chain = None , shadow = None , utc = None , ** options ) : from celery import uuid from kombu . serialization import dumps id = ( id or uuid ( ) ) message = Mock ( name = u'TaskMessage-{0}' . format ( id ) ) message . headers = { u'id' : id , u'task' : name , u'shadow' : shadow } embed = { u'callbacks' : callbacks , u'errbacks' : errbacks , u'chain' : chain } message . headers . update ( options ) ( message . content_type , message . content_encoding , message . body ) = dumps ( ( args , kwargs , embed ) , serializer = u'json' ) message . payload = ( args , kwargs , embed ) return message
create task message in protocol 2 format .