Git Product home page Git Product logo

Comments (8)

jiyis avatar jiyis commented on August 17, 2024

把你代码贴一下看看.

from laravel-nsq.

wangyabener avatar wangyabener commented on August 17, 2024

Controller

   // the data you want to be publish
    $str = [
        'id' => 1,
        'userId' => 2,
        'type' => 4,
        'price' => 7,
        'amount' => 8,
        'takerFee' => 10,
        'makerFee' => 11,
        'source' => 12,
    ];

    Queue::connection('nsq')->push(new EntrustTransactionsJob(), $str);

EntrustTransactionsJob

/**
  * @var int 任务运行的超时时间
  */
 public $timeout = 120;

/**
 * @var string
 */
 public $topic = 'test';

/**
 * @var string
 */
 public $channel = 'web';

/**
 * Create a new job instance.
 *
 * @return void
 */
 public function __construct()
 {
 }

/**
 * Execute the job.
 *
 * @return void
 */
 public function handle()
 {
    $client = $this->job->getCurrentClient();
    $payload = json_decode($this->job->getMessage(), true);
}

from laravel-nsq.

jiyis avatar jiyis commented on August 17, 2024

EntrustTransactionsJob 这个job类的 $topic 属性有设置吗

from laravel-nsq.

wangyabener avatar wangyabener commented on August 17, 2024

有的,刚刚贴错了,已经更新了,麻烦再帮忙看下

from laravel-nsq.

jiyis avatar jiyis commented on August 17, 2024

看起来像是nsq服务端没有publish成功,Errors were: 这后面没有更详细的错误信息吗? 还有把你.env 配置的nsqd地址发下, 或者你可以用 curl -d "<test msg>" http://127.0.0.1:4151/pub?topic=test 命令看看响应什么

from laravel-nsq.

wangyabener avatar wangyabener commented on August 17, 2024

laravel 报错:

image

curl结果是ok的:
image

NsqAdmin:
image

.env
image

from laravel-nsq.

jiyis avatar jiyis commented on August 17, 2024

配错了哦, NSQSD_URL=xxxx:4150 publish是走tcp协议的,所以要配4150端口,4151是http协议的,建议看下文档哦

from laravel-nsq.

wangyabener avatar wangyabener commented on August 17, 2024

好的,已经可以了,Nsq也是第一次接触不太熟悉,十分感谢哈

from laravel-nsq.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.