2017-07-27 59 views
0

任何人都有經驗與塞內卡?Seneca-mesh CL MISSING

我有問題,當我嘗試inclue目...

這是高致病性禽流感路線:

server.route({ 
     method: 'GET', 
     path: '/api/ping', 
     handler: function (req, reply) { 

      server.seneca// load the mesh plugin 
       .use('mesh') 

       // send a message out into the network 
       // the network will know where to send format:hex messages 
       .act('foo:1,v:2', (err: any, out: any) => { 
        console.log(err) 
        // prints #FF0000 
        reply(null, out) 
       }) 

     } 
    }) 

這是我的服務:

require('seneca')({ 
}) 
    //.use('zipkin-tracer', {sampling:1}) 
    .use('entity') 
    .use('ping-logic') 

    .ready(function(){ 
    console.log(this.id) 
    }) 

邏輯:

module.exports = function post(options) { 
    var seneca = this 

    seneca// provide an action for the format:hex pattern 
    .add('foo:1', function (msg, done) { 
    done(null, {x:1,v:100+msg.v}) 
    }) 
    .use('mesh', { auto:true, pin:'foo:1' }) 
} 

我得到錯誤

CL MISSING {富:1,V:2}

人知道什麼是porblem?

回答

1

我也碰到過這個。有兩件事我不得不做:

  1. 使用seneca-mesh插件的主分支。不幸的是在NPM發佈的v0.10.0是舊的(2017年3月7日),並且不與塞內卡v3.4.x工作
  2. 在高致病性禽流感的路線添加seneca.ready(函數())是這樣的:

    server.route({ 
        method: 'GET', 
        path: '/api/ping', 
        handler: function (req, reply) { 
    
        server.seneca// load the mesh plugin 
         .use('mesh') 
         .ready(function() {   
          // send a message out into the network 
          // the network will know where to send format:hex messages 
          this.act('foo:1,v:2', (err: any, out: any) => { 
           console.log(err) 
           // prints #FF0000 
           reply(null, out) 
          }) 
         })    
        } 
    }) 
    

還要檢查這個相關的github問題,我問的主要貢獻者如果有很快就會有一個新的固定版本上NPM計劃: https://github.com/senecajs/seneca-mesh/issues/90

希望這有助於

+0

FYI一個更新版本的seneca-mesh插件(v0.11.0)現在是npm上的最新版本,與seneca v3.4.1協同工作=>不需要使用master分支。 – Adam