func (m *CloudEventsEnvelope) Ack() {
	m.done(true)
}
Ack indicates successful processing of a Message passed to the Subscriber.Receive callback.
It should not be called on any other Message value.
If protocol acknowledgement fails, the Message will be redelivered.
Client code must call Ack or Nack when finished for each received Message.
Calls to Ack or Nack have no effect after the first call.
package protocol
import (
	"fmt"
	jsoniter "github.com/json-iterator/go"
	"github.com/nats-io/nuid"
	"log"
)
var uidGen = nuid.New()
const (
	DefaultCloudEventType = "com.pulse.event.sent"
	CloudEventsSpecVersion = "1.0"
	ContentType = "application/cloudevents+json"
	DefaultCloudEventSource = "pulse"
	DefaultCloudEventWebhook = ""
)
type CloudEventsEnvelope struct {
	ID          string `json:"id"`
	Source      string `json:"source"`
	Type        string `json:"type"`
	SpecVersion string `json:"specversion"`
	DataContentType string `json:"datacontenttype"`
	Data            []byte `json:"data"`
	Topic           string `json:"topic"`
	WebhookURL      string `json:"webhookUrl"`
	OrderingKey     string `json:"orderingKey"`  
	Size int
	DeliveryAttempt *int
	calledDone      bool
	DoneFunc        func(string, bool) `json:"-"`
}
func NewSimpleByteMessage(data []byte) *CloudEventsEnvelope {
	e, err := NewCloudEventsEnvelope("", "", "", "", "", "", "", data)
	if err != nil {
		log.Println(err)
	}
	return e
}
func NewCloudEventsEnvelope(id, source, datacontentType, eventType, topic, webhook, orderingKey string, data []byte) (*CloudEventsEnvelope, error) {
	if id == "" {
		id = uidGen.Next()
	}
	if source == "" {
		source = DefaultCloudEventSource
	}
	if eventType == "" {
		eventType = DefaultCloudEventType
	}
	if webhook == "" {
		webhook = DefaultCloudEventWebhook
	}
	e := &CloudEventsEnvelope{
		ID:              id,
		SpecVersion:     CloudEventsSpecVersion,
		DataContentType: datacontentType,
		Source:          source,
		Type:            eventType,
		Topic:           topic,
		Data:            data,
		WebhookURL:      webhook,
		OrderingKey:     orderingKey,
	}
	b, err := jsoniter.ConfigFastest.Marshal(e)
	if err != nil {
		return nil, err
	}
	e.Size = len(b)
	return e, nil
}
func (m *CloudEventsEnvelope) String() string {
	return fmt.Sprintf("Id: %s Data: %s OrderingKey: %s DeliveryAttempt: %d calledDone: %v DoneFunc: %T size: %d", m.ID, m.Data, m.OrderingKey, m.DeliveryAttempt, m.calledDone, m.DoneFunc, m.Size)
}