chore(queue): Add NSQ Parameter.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									7b16a4db98
								
							
						
					
					
						commit
						0b0f47e4f9
					
				
							
								
								
									
										4
									
								
								main.go
								
								
								
								
							
							
						
						
									
										4
									
								
								main.go
								
								
								
								
							| 
						 | 
				
			
			@ -331,6 +331,10 @@ func main() {
 | 
			
		|||
		)
 | 
			
		||||
	case core.NSQ:
 | 
			
		||||
		w = nsq.NewWorker(
 | 
			
		||||
			nsq.WithAddr(cfg.Queue.NSQ.Addr),
 | 
			
		||||
			nsq.WithTopic(cfg.Queue.NSQ.Topic),
 | 
			
		||||
			nsq.WithChannel(cfg.Queue.NSQ.Channel),
 | 
			
		||||
			nsq.WithMaxInFlight(int(cfg.Core.WorkerNum)),
 | 
			
		||||
			nsq.WithRunFunc(func(msg *n.Message) error {
 | 
			
		||||
				if len(msg.Body) == 0 {
 | 
			
		||||
					// Returning nil will automatically send a FIN command to NSQ to mark the message as processed.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue