[zeromq-dev] Creating a malamute broker in process

Pieter Hintjens ph at imatix.com
Wed Apr 1 18:38:50 CEST 2015


Look at mlm_server_test:

    zactor_t *server = zactor_new (mlm_server, "mlm_server_test");
    zstr_sendx (server, "BIND", "tcp://127.0.0.1:9999", NULL);

-Pieter

On Wed, Apr 1, 2015 at 5:42 PM, Kenneth Adam Miller
<kennethadammiller at gmail.com> wrote:
> Oh ok... I'm trying to find out how to start an actor.
> I tried telling the broker what endpoint to bind on in source with:
>
>   zstr_sendx(server, "mlm_server", "BIND", "endpoint", "tcp://*:9999",
> NULL);
>
> but that didn't quite work. I don't want to ship a config file, I only need
> it to work within the unit test. Thanks so much for your help!
>
> On Wed, Apr 1, 2015 at 3:10 AM, Pieter Hintjens <ph at imatix.com> wrote:
>>
>> You have to at the lest:
>>
>> - start the actor
>> - tell it what endpoint to bind on OR tell it what config file to load
>>
>> -Pieter
>>
>> On Wed, Apr 1, 2015 at 5:56 AM, Kenneth Adam Miller
>> <kennethadammiller at gmail.com> wrote:
>> > So, I wanted to create a specific broker on a dedicated thread that I
>> > could
>> > start up and shut down easily in order to facilitate testing. Here's
>> > what I
>> > had for that, consulting mlm_shell, malamute.c and mlm_tutorial:
>> >
>> > void startUP(bool verbose=true, zactor_t **server=&global_server) {
>> >   std::cout << "Initializing broker" << std::endl;
>> >   *server = zactor_new (mlm_server, (void *) "Malamute");
>> >   if (verbose) {
>> >     zstr_send (server, "VERBOSE");
>> >     zsock_wait(server);
>> >   }
>> >   //zstr_sendx (server, "LOAD", "malamute.cfg", NULL);
>> >
>> >   zactor_t *auth = zactor_new (zauth, NULL);
>> >   assert (auth);
>> >   if (verbose) {
>> >     zstr_sendx (auth, "VERBOSE", NULL);
>> >     zsock_wait (auth);
>> >   }
>> >   std::cout << "Broker initialized" << std::endl;
>> > }
>> >
>> > I tried removing everything except the zactor_new(mlm_server call, and I
>> > tried variations on arguments passed to it.
>> >
>> > I can start a malamute server on the command line, and my unit tests
>> > interact with that, but I'd like my unit tests to not require human
>> > intervention.
>> >
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list