func (this *service) publish(msg *message.PublishMessage, onComplete OnCompleteFunc) error { //Log.Debugc(func() string{ return fmt.Sprintf("service/publish: Publishing %s", msg)}) // Log.Errorc(func() string{ return fmt.Sprintf("msg is : %v", msg)}) _, err := this.writeMessage(msg) if err != nil { return fmt.Errorf("(%s) Error sending %s message: %v", this.cid(), msg.Name(), err) } switch msg.QoS() { case message.QosAtMostOnce: if onComplete != nil { return onComplete(msg, nil, nil) } return nil case message.QosAtLeastOnce: return this.sess.Pub1ack.Wait(msg, onComplete) case message.QosExactlyOnce: return this.sess.Pub2out.Wait(msg, onComplete) } return nil }
func onPublishFunc(msg *message.PublishMessage) error { jklog.L().Infoln("Recevied on publish func") jklog.L().Infoln("name: ", msg.Name()) jklog.L().Infoln("payload: ", string(msg.Payload())) return nil }