@@ -265,7 +265,7 @@ func (d DuplicateHandlerNameError) Error() string {
265265//
266266// publishTopic is a topic to which router will produce messages returned by handlerFunc.
267267// When handler needs to publish to multiple topics,
268- // it is recommended to use AddNoPublisherHandler and inject a Publisher or implement middleware
268+ // it is recommended to use AddConsumerHandler and inject a Publisher or implement middleware
269269// which will catch messages and publish to topic based on metadata for example.
270270//
271271// If handler is added while router is already running, you need to explicitly call RunHandlers().
@@ -329,9 +329,8 @@ func (r *Router) AddHandler(
329329 }
330330}
331331
332- // AddNoPublisherHandler adds a new handler.
333- // This handler cannot return messages.
334- // When message is returned it will occur an error and Nack will be sent.
332+ // AddConsumerHandler adds a new handler that does not return any messages.
333+ // It can publish messages by directly using a Publisher.
335334//
336335// handlerName must be unique. For now, it is used only for debugging.
337336//
@@ -340,7 +339,7 @@ func (r *Router) AddHandler(
340339// subscriber is Subscriber from which messages will be consumed.
341340//
342341// If handler is added while router is already running, you need to explicitly call RunHandlers().
343- func (r * Router ) AddNoPublisherHandler (
342+ func (r * Router ) AddConsumerHandler (
344343 handlerName string ,
345344 subscribeTopic string ,
346345 subscriber Subscriber ,
@@ -353,6 +352,27 @@ func (r *Router) AddNoPublisherHandler(
353352 return r .AddHandler (handlerName , subscribeTopic , subscriber , "" , disabledPublisher {}, handlerFuncAdapter )
354353}
355354
355+ // AddNoPublisherHandler adds a new handler.
356+ // This handler cannot return messages.
357+ //
358+ // handlerName must be unique. For now, it is used only for debugging.
359+ //
360+ // subscribeTopic is a topic from which handler will receive messages.
361+ //
362+ // subscriber is Subscriber from which messages will be consumed.
363+ //
364+ // If handler is added while router is already running, you need to explicitly call RunHandlers().
365+ //
366+ // Deprecated: use AddConsumerHandler instead.
367+ func (r * Router ) AddNoPublisherHandler (
368+ handlerName string ,
369+ subscribeTopic string ,
370+ subscriber Subscriber ,
371+ handlerFunc NoPublishHandlerFunc ,
372+ ) * Handler {
373+ return r .AddConsumerHandler (handlerName , subscribeTopic , subscriber , handlerFunc )
374+ }
375+
356376// Run runs all plugins and handlers and starts subscribing to provided topics.
357377// This call is blocking while the router is running.
358378//
0 commit comments