func()

in internal/events/pubsub/pubsub.go [67:89]


func (e *LegacyPushSubscriptionEvent) ToBackgroundEvent(topic string) *fftypes.BackgroundEvent {
	timestamp := e.Message.PublishTime
	if timestamp.IsZero() {
		timestamp = time.Now()
	}
	return &fftypes.BackgroundEvent{
		Metadata: &metadata.Metadata{
			EventID:   e.ID,
			Timestamp: timestamp,
			EventType: pubsubEventType,
			Resource: &metadata.Resource{
				Name:    topic,
				Type:    pubsubMessageType,
				Service: pubsubService,
			},
		},
		Data: map[string]interface{}{
			"@type":      pubsubMessageType,
			"data":       e.Message.Data,
			"attributes": e.Message.Attributes,
		},
	}
}