Beispiel #1
0
static int
start_mq_client ()
{
    seaf_message ("starting mq client ...\n");
    
    CcnetMqclientProc *mqclient_proc;

    mqclient_proc = (CcnetMqclientProc *)
        ccnet_proc_factory_create_master_processor
        (ctl->client->proc_factory, "mq-client");
    
    if (!mqclient_proc) {
        seaf_warning ("Failed to create mqclient proc.\n");
        return -1;
    }

    static char *topics[] = {
        "seaf_server.heartbeat",
        "seaf_mon.heartbeat",
    };

    ccnet_mqclient_proc_set_message_got_cb (mqclient_proc, mq_cb, NULL);

    /* Subscribe to messages. */
    if (ccnet_processor_start ((CcnetProcessor *)mqclient_proc,
                               G_N_ELEMENTS(topics), topics) < 0) {
        seaf_warning ("Failed to start mqclient proc\n");
        return -1;
    }

    ctl->mqclient_proc = mqclient_proc;

    return 0;
}
Beispiel #2
0
static void
start_mq_client ()
{
    CcnetMqclientProc *mqclient_proc;
    
    mqclient_proc = (CcnetMqclientProc *)
        ccnet_proc_factory_create_master_processor
        (applet->client->proc_factory, "mq-client");

    if (!mqclient_proc) {
        applet_warning ("Failed to create mq-client!\n");
        applet_exit(1);
    }

    ccnet_mqclient_proc_set_message_got_cb (mqclient_proc, mq_cb, NULL);
    
    static char *topics[] = {
        "seafile.heartbeat",
        "seafile.notification",
    };
    
    /* Subscribe to messages. */
    if (ccnet_processor_start ((CcnetProcessor *)mqclient_proc,
                               G_N_ELEMENTS(topics), topics) < 0) {
        
        applet_warning ("Failed to start mq-client!\n");
        applet_exit(1);
    }

    applet->mqclient_proc = mqclient_proc;
}
void MessageListener::startMqClient()
{
    mqclient_proc_ = (CcnetMqclientProc *)
        ccnet_proc_factory_create_master_processor
        (async_client_->proc_factory, "mq-client");

    ccnet_mqclient_proc_set_message_got_cb (mqclient_proc_,
                                            (MessageGotCB)messageCallback,
                                            this);

    static const char *topics[] = {
        // "seafile.heartbeat",
        "seafile.notification",
    };

    if (ccnet_processor_start ((CcnetProcessor *)mqclient_proc_,
                               G_N_ELEMENTS(topics), (char **)topics) < 0) {

        seafApplet->errorAndExit("Failed to start mq client");
    }
}