Ejemplo n.º 1
0
def add_message(request):
    result="OK"
    try:
        message=request.POST.get("msg",'')
        tq_id=request.POST.get("tq_id")
        message_intime=message
        RedisService.append_value("ci_build_log"+tq_id,message_intime,7200)
        welcome = RedisMessage(message_intime)  # create a welcome message to be sent to everybody
        RedisPublisher(facility=tq_id, broadcast=True).publish_message(welcome)
    except Exception as ex:
        SimpleLogger.exception(ex)
        result=str(ex)
    return HttpResponse(result)
Ejemplo n.º 2
0
 def post(self, request, *args, **kwargs):
     result = "OK"
     try:
         message = request.data.get("msg", '')
         tq_id = request.data.get("tq_id")
         message_intime = message
         RedisService.append_value("ci_build_log" + str(tq_id),
                                   message_intime, 7200)
         welcome = RedisMessage(
             message_intime
         )  # create a welcome message to be sent to everybody
         RedisPublisher(facility=str(tq_id),
                        broadcast=True).publish_message(welcome)
     except Exception as ex:
         SimpleLogger.exception(ex)
         result = str(ex)
     return Response(result)