mirror of
				https://github.com/oarkflow/mq.git
				synced 2025-10-31 18:22:33 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			420 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			420 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package tasks
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"fmt"
 | |
| 
 | |
| 	"github.com/oarkflow/mq"
 | |
| )
 | |
| 
 | |
| func SchedulerHandler(ctx context.Context, task *mq.Task) mq.Result {
 | |
| 	fmt.Printf("Processing task: %s\n", task.ID)
 | |
| 	return mq.Result{Error: nil}
 | |
| }
 | |
| 
 | |
| func SchedulerCallback(ctx context.Context, result mq.Result) error {
 | |
| 	if result.Error != nil {
 | |
| 		fmt.Println("Task failed!")
 | |
| 	} else {
 | |
| 		fmt.Println("Task completed successfully.")
 | |
| 	}
 | |
| 	return nil
 | |
| }
 | 
