Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    matiger
    @matiger
    is this the same issue as above?
    matiger
    @matiger
    Looks like it is because the PLUGIN_TAG for the amp-transport is 2.0.0 and you guys changed it so no .s are allowed anymore.
    2.2.0*
    matiger
    @matiger
    There might be a fix for that: senecajs/seneca-amqp-transport#130
    shonabell
    @shonabell
    Hi
    can someone guide me? I'm trying to setup like an API gateway. How can I define the routes in the plugin and have the api gateway redirect to the micro services?
    Should the api gateway not use sencia web and just proxy to the micro services?
    neo6053
    @neo6053
    hi, is there any documentation for legacy function such as loghandler?
    Khánh Trần
    @rualatngua
    Should the api gateway not use sencia web and just proxy to the micro services?
    You can use Hapi with a good plugin for seneca.
    I mostly use ExpressJS or Fastify as API gateway, I add a seneca-client to forward requests to downstream services.
    ghter123
    @ghter123
    I am a newbie and I am very upset now. Please pay attention to my Issue post at senecajs/seneca-store-test#47.
    Thank you.
    Tommi Vainikainen
    @tvainika
    What tracing systems have you used with senecajs to have traces for interaction between microservices?
    pusaphil
    @pusaphil
    I am new in NodeJS and i am using seneca version 3.4.3 with seneca-amqp-transport and rabbitMQ as a broker (not sure if terminology is correct).
    I noticed that if you have a seneca listener script (RPC) connect to rabbitMQ, and somehow kill the rabbitMQ, the listener dies as well. My question is how do you track the "dying" part of the listener script? I noticed it emits a 'kill' signal that can be capture via process.on('kill', () => {}), but i want to capture it on the seneca level - something like seneca.on('disconnect', () => {}) kinda thing.
    Mike Lindenau
    @MikeLindenau
    This is super raw but would love any feedback. https://github.com/nscale/usrv
    Julien Perrenoud
    @jfperren

    Hey everyone!

    I am a new Seneca user trying to use Seneca as part of my fairly simple Express/MongoDB setup. More specifically, I am trying to make my models use seneca-entity backed by seneca-mongo-store. This works great, but I cannot find a good way to implement some kind of schema validation.

    In a previous project, I used Mongoose to create schemas which would automatically validate the data upon creation/update. I would like a similar thing here but I could not find good documentation about mongoose/seneca integration online and it feels like Mongoose would be fairly redundant here, or at least a bit clunky to integrate. I feel like there's got to be a better way.

    Am I doing this wrong? How are you guys validating your mongodb data with seneca entities?

    Thank you all in the community for building this project!

    Fran
    @Paker30
    Hi @jfperren I'm not an expert either but at my company we work with Seneca and if you want to add some schema validation, take a look at https://github.com/senecajs/seneca-joi it would give you validation schemas against your pines, you can always check what you send in the pin with the schema
    Hi guys, I would like to make some kind of health check service validation through http, this is due to at my company devops need some kind of endpoint to check if the service is available, I've been looking through zipking but I haven't found any way to check the current services through its API (it seems the /service endpoints only returns all the services which are or have been in zipking) The idea I have in my mind is to add a health check ping by service and call it through an API connected to Seneca, I would like to know your opinions or some tools or modules which could help us.
    Thanks a lot and any idea idea would be appreciate
    Julien Perrenoud
    @jfperren
    @Paker30 Awesome, this is exactly what I was looking for. Thanks a lot!
    Juan Antelo-Justiniano
    @JuanAntelo
    Hello. Is it possible to persist memory between endpoint calls?
    For me, this seems like the only limitation of a serverless framework but i wonder if there is a workaround / solution
    Josh Reeter
    @jreeter
    @JuanAntelo you could use something like Redis to persist state to "between endpoint calls"
    Shyam Pratap Singh
    @spsingh559
    Hi Team, I am using seneca-mesh for auto service discovery. Could you please let me know how to make this microservices distributed in the sense that, one serviceA is running in VM1(virtual machine) and another serviceB is running in VM2 and i am calling microservice from VM3, using seneca.act(Pattern) for serviceA
    currently i have done this setup in single VM and services are getting discoverable, but i want to make it distributed. It would be a great help
    rrrodzilla
    @rrrodzilla
    If I have one service exposing a web api using seneca-web, how can that service discover the other services if it's not part of the mesh network the remaining services are on? Does the web api service also participate in the mesh?
    rrrodzilla
    @rrrodzilla
    cool thx
    Benson Lin
    @icebro_gitlab

    hi , i am just try to custom my logger and check this tutorials/logging-with-seneca
    http://senecajs.org/docs/tutorials/logging-with-seneca.html

    but got this error

    D:\code\seneca-log-test\sales-tax-log-handler.js:8
    {level: 'all', handler: seneca.loghandler.file('shop.log')}
    ^

    TypeError: Cannot read property 'file' of undefined
    at Object.<anonymous> (D:\code\seneca-log-test\sales-tax-log-handler.js:8:49)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)

    at bootstrap_node.js:625:3

    ================================
    any sugguestion?

    José da Mata
    @josemf
    hi guys, I've a general question about concurrent service operation calls
    does Seneca handles concurrent requests from clients
    I'm defining a few modules that will listen requests from clients, and one of those generates PDF using a puppeteer integration
    I'm not sure how much load this operation will have to handle in the future, but I'm worried if seneca will be able to this with a TCP transport (no queuing) on a "default" settings basis
    José da Mata
    @josemf
    Do you guys know how to measure this on seneca? I'm also wondering about what would be the best practice for approaching scalability issues
    Thank you guys!
    Fran
    @Paker30
    hi guys Does any have issues register pins with the latest version of seneca-mesh? I've upgrade and I can't register pines, I try to register new pines with chairo
    Luiz Carlos Muniz
    @lcmuniz_twitter
    Hi guys. Can you help me? A would like to know if more the one seneca microservice can respond to the same message. I tried to write two microservices that respond to the same message but was not able to do so. I am new in seneca programming.
    Shyam Pratap Singh
    @spsingh559
    @lcmuniz_twitter can you bit specified what actually you want to achieve. Microservices respond based on the pattern defined, if you want the same message should be received by two different microservices, create a two Seneca client with two different patterns and send the message.
    Shyam Pratap Singh
    @spsingh559

    https://github.com/spsingh559/microserviceTemplate

    This is reference implementation of Seneca microservices along with API hosted on node js server. It may help to see the entire Seneca flow.

    Luiz Carlos Muniz
    @lcmuniz_twitter
    Let's say I have a microservice that sends a message with the pattern "type:client,cmd:list", what I am asking is if two other microservices that listen to "type:client,cmd:list" pattern can respond. I am asking this because I implemented this scenario and only one of them is replying, the other is not. It is like if the first that receives the message consumes it and the other does not receive. You said that I have to create two microservices with to diferent patterns, but I want to microservices thar respond to the same pattern. Maybe I am not doing right. Like I said, I am using seneca for the first time.
    Shyam Pratap Singh
    @spsingh559

    Seneca Microservices discover each other using mesh network, once you publish a message, mesh find out the best matching pattern and deliver the message to the corresponding microservice.
    So you are right, anyone will respond out of two if defined by the same pattern.

    But if your use case is to send the same message to two microservices, as I said " use two different patterns" something like this "type:client, cmd:message" and "type:client, cmd:duplicateMessage".

    And conceptually one microservice should do one dedicated task, assigning two MS to process similar tasks is not desirable.

    Stephan Kennedy
    @ks32849
    Having problems with seneca prior while following seneca-in-practice. I'm getting:
    Error: seneca: The prior method must be called inside an action function. Arguments were: [Arguments]
    when running this:
    module.exports = function(options) {
        this.add({role: 'math', cmd: 'sum'}, (msg, done) => {
            done(null, {answer: msg.left + msg.right});
        });
    
        this.add({role: 'math', cmd: 'product'}, (msg, done) => {
            done(null, {answer: msg.left * msg.right});
        });
    
        this.add({role: 'math', cmd: 'sum', integer: true}, (msg, done) => {
            done(null, {answer: Math.floor(msg.left) + Math.floor(msg.right)});
        });
    
        this.add({role: 'math', cmd: 'sum'}, (msg, done) => {
            if (isFinite(msg.left) && isFinite(msg.right)) {
                this.prior({role: 'math', cmd: 'sum', left: msg.left, right: msg.right}, (err, result) => {
                    if( err ) return done( err );
                    result.info =  msg.left + ' + ' + msg.right;
                    done(null, result);
                });
            }
            else {
                done(new Error('Expected left and right to be numbers.'), null);
            }
        });
    
        return 'operations';
    }
    Shyam Pratap Singh
    @spsingh559

    @ks32849 I don't know why are you defining role:'math',cmd:'sum' twice, its already been declared on top.
    And since you are not over riding any function, prior has no use here and unless and until you want one function to handle multiple use case. Check the proper uses of prior function along with right syntax here

    https://senecajs.org/docs/tutorials/understanding-prior-actions.html

    Shyam Pratap Singh
    @spsingh559

    const seneca=require('seneca')();

    seneca
    .add({role: 'math', cmd: 'sum'}, function(msg, done){ //declaring without arrow function
    done(null, {answer: msg.left + msg.right});
    })

    .add({role: 'math', cmd: 'product'}, function(msg, done) { //declaring without arrow function
        done(null, {answer: msg.left * msg.right});
    })
    
    .add({role: 'math', cmd: 'sum', integer: true}, function(msg, done) { //declaring without arrow function
        done(null, {answer: Math.floor(msg.left) + Math.floor(msg.right)});
    })
    
    .add({role: 'math', cmd: 'sum'}, function(msg, done)  { //declaring without arrow function
        if (isFinite(msg.left) && isFinite(msg.right)) {
            this.prior(msg, (err, result) => { //pass the message object only, no need to pass pattern
                if( err ) return done( err );
                result.info =  msg.left + ' + ' + msg.right;
                done(null, result);
            });
        }
        else {
            done(new Error('Expected left and right to be numbers.'), null);
        }
    })
    
    //testing the role math, cmd: sum service
    .act({role: 'math', cmd: 'sum',left: 10, right: 5},function (err,output){
        console.log(err,output); //null { answer: 15, info: '10 + 5' }
    })
    @ks32849 this is working code, which can be tested with prior

    @ks32849 your updated code, i hope this works for you.

    module.exports = function(options) {
    this.add({role: 'math', cmd: 'sum'}, function(msg, done) {
    done(null, {answer: msg.left + msg.right});
    });

    this.add({role: 'math', cmd: 'product'}, function(msg, done) {
        done(null, {answer: msg.left * msg.right});
    });
    
    this.add({role: 'math', cmd: 'sum', integer: true}, function(msg, done) {
        done(null, {answer: Math.floor(msg.left) + Math.floor(msg.right)});
    });
    
    this.add({role: 'math', cmd: 'sum'}, function(msg, done) {
        if (isFinite(msg.left) && isFinite(msg.right)) {
            this.prior(msg, (err, result) => {
                if( err ) return done( err );
                result.info =  msg.left + ' + ' + msg.right;
                done(null, result);
            });
        }
        else {
            done(new Error('Expected left and right to be numbers.'), null);
        }
    });
    
    return 'operations';

    }

    Stephan Kennedy
    @ks32849
    Thanks @spsingh559 - seems the issue is this.prior is only valid if the callback in add is defined as an inline function and not an arrow function.
    Shyam Pratap Singh
    @spsingh559
    yeah, right
    Karnphong Kieoprasert
    @karnphongkie
    How can I use middleware with seneca-web in the example seem not works.
    using express.
    Shyam Pratap Singh
    @spsingh559
    can u post the sample code or link for reference @karnphongkie ?
    Karnphong Kieoprasert
    @karnphongkie
    Thank @spsingh559 I have solved by add middleware in the route.
    RAJAT
    @rajatprogrammer
    anybody know how to connect seneca without define a rabbit Mq port
    I have cloud service of rabbit mq in which port is managed by the service itself i am not able to connect seneca with that cloud hosted rabbit Mq