<commit_before>#include <iostream>
#include "proton/message.h"
#include "proton/messenger.h"
#include "../src/Beacon.h"

using namespace std;


void die(const char *file, int line, const char *message) {
    fprintf(stderr, "%s:%i: %s\n", file, line, message);
    exit(1);
}

inline void check(pn_messenger_t *messenger) {
    if(pn_messenger_errno(messenger)) {
      die(__FILE__, __LINE__, pn_error_text(pn_messenger_error(messenger)));
    }
}

/*
 * Testing sending a message to a topic using the proton api
 */
int main(int argc, char **argv) {

    pn_message_t *message;
    pn_messenger_t *messenger;
    pn_data_t *body;
    const char *brokerURL = "amqp://192.168.1.107:5672/topic://beaconEvents";


    messenger = pn_messenger(NULL);

    pn_messenger_start(messenger);
    pn_messenger_subscribe(messenger, brokerURL);

    while(true) {
        pn_messenger_recv(messenger, 1024);
        check(messenger);

        while(pn_messenger_incoming(messenger))
        {
            pn_messenger_get(messenger, message);
            check(messenger);
            {
                pn_data_t *properties = pn_message_properties(message);
                char buffer[1024];
                size_t buffsize = sizeof(buffer);
                const char* subject = pn_message_get_subject(message);
                pn_data_t *body = pn_message_properties(message);
                pn_data_format(body, buffer, &buffsize);<commit_msg>Init message<commit_after>#include <iostream>
#include "proton/message.h"
#include "proton/messenger.h"
#include "../src/Beacon.h"

using namespace std;


void die(const char *file, int line, const char *message) {
    fprintf(stderr, "%s:%i: %s\n", file, line, message);
    exit(1);
}

inline void check(pn_messenger_t *messenger) {
    if(pn_messenger_errno(messenger)) {
      die(__FILE__, __LINE__, pn_error_text(pn_messenger_error(messenger)));
    }
}

/*
 * Testing sending a message to a topic using the proton api
 */
int main(int argc, char **argv) {

    pn_message_t *message;
    pn_messenger_t *messenger;
    pn_data_t *body;
    const char *brokerURL = "amqp://192.168.1.107:5672/topic://beaconEvents";


    messenger = pn_messenger(NULL);
    message = pn_message();
    pn_messenger_start(messenger);
    pn_messenger_subscribe(messenger, brokerURL);

    while(true) {
        pn_messenger_recv(messenger, 1024);
        check(messenger);

        while(pn_messenger_incoming(messenger))
        {
            pn_messenger_get(messenger, message);
            check(messenger);
            {
                pn_data_t *properties = pn_message_properties(message);
                char buffer[1024];
                size_t buffsize = sizeof(buffer);
                const char* subject = pn_message_get_subject(message);
                pn_data_t *body = pn_message_properties(message);
                pn_data_format(body, buffer, &buffsize);
{'fraction_non_alphanumeric': 0.11578221915920055, 'fraction_numerical': 0.015851137146795313, 'mean_word_length': 2.9767123287671233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4710210', 'n_tokens_mistral': 1052, 'n_tokens_neox': 930, 'n_words': 186}