Skip to content

Creation of Consumer and Producer blocks #74

@Lukemtesta

Description

@Lukemtesta

Standard: C++17
OS: Windows 10
Visual Studio: 17.1.0

I follow the example to create a two executables: A publisher and consumer. Neither accept any input arguments.

In both cases, the producer and consumer blocks execution. The last print out is "creating producer" or "creating consumer".

The function comments say the consumer is creating in a background thread. This should be a non-blocking operation. That is not what I am seeing. Also the verbosity is set to true but no output is provided.

Linked libraries: czmq.lib;libsodium.lib;dafka.lib;

Please advise for next steps.

#include "dafka_library.h"
#include "dafka.h"
#include "dafka_producer.h"
#include "dafka_producer_msg.h"

#include

int main()
{
    bool verbose = true;

	std::cout << "starting context" << std::endl;

    zconfig_t* config = zconfig_new("root", NULL);
    zconfig_put(config, "test/verbose", verbose ? "1" : "0");
    zconfig_put(config, "beacon/interval", "50");
    zconfig_put(config, "beacon/verbose", verbose ? "1" : "0");
    zconfig_put(config, "beacon/sub_address", "inproc://consumer-tower-sub");
    zconfig_put(config, "beacon/pub_address", "inproc://consumer-tower-pub");
    zconfig_put(config, "tower/verbose", verbose ? "1" : "0");
    zconfig_put(config, "tower/sub_address", "inproc://consumer-tower-sub");
    zconfig_put(config, "tower/pub_address", "inproc://consumer-tower-pub");
    zconfig_put(config, "consumer/verbose", verbose ? "1" : "0");
    zconfig_put(config, "producer/verbose", verbose ? "1" : "0");
    zconfig_put(config, "store/verbose", verbose ? "1" : "0");
    zconfig_put(config, "store/db", "C:\\Users\\pc\\Documents\\gh\\git\\HippoR6Build\\debug\\bin\\storedb");

    const char* topic = "hello";

    std::cout << "creating consumer" << std::endl;

    dafka_consumer_args_t args = {config = config};
    dafka_consumer_t* consumer = dafka_consumer_new(&args);

    std::cout << "subscribing to topic" << std::endl;

    dafka_consumer_subscribe(consumer, topic);

    std::cout << "Reading message" << std::endl;

    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions