code: func (b *Backend) updateState(taskState *tasks.TaskState) error {
  	message, err := json.Marshal(taskState)
  	if err != nil {
  		return fmt.Errorf("JSON marshal error: %s", err)
  	}
  
  	declareQueueArgs := amqp.Table{
  		// Time in milliseconds
  		// after that message will expire
  		"x-message-ttl": int32(b.getExpiresIn()),
  		// Time after that the queue will be deleted.
  		"x-expires": int32(b.getExpiresIn()),
  	}
  	conn, channel, queue, confirmsChan, _, err := b.Connect(
  		b.GetConfig().Broker,
  		b.GetConfig().TLSConfig,
  		b.GetConfig().AMQP.Exchange,     // exchange name
  		b.GetConfig().AMQP.ExchangeType, // exchange type
  		taskState.TaskUUID,              // queue name
  		false,                           // queue durable
  		true,                            // queue delete when unused
  		taskState.TaskUUID,              // queue binding key
  		nil,                             // exchange declare args
  		declareQueueArgs,                // queue declare args
  		nil,                             // queue binding args
  	)
  	if err != nil {
  		return err
  	}
  	defer b.Close(channel, conn)
  
  	if err := channel.Publish(
  		b.GetConfig().AMQP.Exchange, // exchange
  		queue.Name,                  // routing key
  		false,                       // mandatory
  		false,                       // immediate
  		amqp.Publishing{
  			ContentType:  "application/json",
  			Body:         message,
  			DeliveryMode: amqp.Persistent, // Persistent // Transient
  		},
  	); err != nil {
  		return err
  	}
  
  	confirmed := <-confirmsChan
  
  	if confirmed.Ack {
  		return nil
  	}
  
  	return fmt.Errorf("Failed delivery of delivery tag: %d", confirmed.DeliveryTag)
  }
docs: // updateState saves current task state