PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, April 19, 2022

[FIXED] How to send data from laravel to a redis queue implemented using Bull queue

 April 19, 2022     bull-queue, laravel, nestjs, node.js, php     No comments   

Issue

I have implemented Bull queue in nestjs project but want producer to be a laravel project. I use following command to produce

Redis::command('zadd', ['bull:test:delayed', 1, $data]);

and at consumer use

@Processor('test')
export class ConsumerProcessor {
  @Process({concurrency:13})
  handle(j: Job<unknown>) {
    this.logger.log(j.id);
  }
}

The $data added at producer is accessible via job.id, how can I access it using job.data and have a unique id? What changes needs to be done at producer side?


Solution

Below code works:

A="some unique identifier";
Redis::command("hmset",['bull:<queuename>:<A>', "data" , json_encode($data)]); 
Redis::command('zadd', ['bull:<queuename>:delayed', 1, A]);


Answered By - shivamkss
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing