// NewSubscriber returns a new verifiable credential subscriber.
NewSubscriber returns a new verifiable credential subscriber.
// NewSubscriber returns a new verifiable credential subscriber .
func NewSubscriber(pubSub pubSub, processor anchorEventProcessor) (*Subscriber, error) {
	h := &Subscriber{
		processAnchorEvent: processor,
		jsonUnmarshal:      json.Unmarshal,
	}
	h.Lifecycle = lifecycle.New("anchoreventsubscriber",
		lifecycle.WithStart(h.start),
	)
	logger.Debugf("Subscribing to topic [%s]", anchorEventTopic)
	vcChan, err := pubSub.Subscribe(context.Background(), anchorEventTopic)
	if err != nil {
		return nil, fmt.Errorf("subscribe to topic [%s]: %w", anchorEventTopic, err)
	}
	h.vcChan = vcChan
	return h, nil
}
func NewSubscriber ( pubSub pubSub , processor anchorEventProcessor ) ( * Subscriber , error ) { h := & Subscriber { processAnchorEvent : processor , jsonUnmarshal : json . Unmarshal , } h . Lifecycle = lifecycle . New ( " " , lifecycle . WithStart ( h . start ) , ) logger . Debugf ( " " , anchorEventTopic ) vcChan , err := pubSub . Subscribe ( context . Background ( ) , anchorEventTopic ) if err != nil { return nil , fmt . Errorf ( " " , anchorEventTopic , err ) } h . vcChan = vcChan return h , nil }
NewSubscriber returns a new verifiable credential subscriber.
NewSubscriber returns a new verifiable credential subscriber .