Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of Consumer and Producer blocks #74

Open
Lukemtesta opened this issue Jul 18, 2022 · 0 comments
Open

Creation of Consumer and Producer blocks #74

Lukemtesta opened this issue Jul 18, 2022 · 0 comments

Comments

@Lukemtesta
Copy link

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;

    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant