hku-ect / libsphactor

"Extended nodal actor framework based on zactor"
Other
3 stars 4 forks source link

Expose 0MQ filtering on sub sockets #88

Closed sphaero closed 2 years ago

sphaero commented 2 years ago

This adds methods to add and remove filters on subscribe sockets (the receiving socket of the actor). Filtering is actually done on the pub sockets (sender side). So if a filter doesn't match the message isn't even send.

example:

        sphactor_t *filteract = sphactor_new(api_sphactor, NULL, NULL, NULL);
        sphactor_t *senderact = sphactor_new(api_sphactor, NULL, NULL, NULL);
        int rc = sphactor_ask_connect(filteract, sphactor_ask_endpoint(senderact));
        assert(rc == 0);
        sphactor_ask_add_filter(filteract, "TEST"); // add a TEST filter
        sphactor_ask_api(senderact, "SEND", "s", "TESTAPI"); // this one is received
        sphactor_ask_api(senderact, "SEND", "s", "BLAA"); // this one is not received

I see this PR also fixes an issue with loading not registered (unknown) actors. Oops, but a very welcome fix