arpadboda commented on a change in pull request #613: Minificpp 927 Nanofi
tailfile delimited processor
URL: https://github.com/apache/nifi-minifi-cpp/pull/613#discussion_r309660193
##########
File path: nanofi/src/api/nanofi.cpp
##########
@@ -124,25 +124,42 @@ nifi_instance *create_instance(const char *url,
nifi_port *port) {
return instance;
}
-standalone_processor *create_processor(const char *name) {
+standalone_processor * create_processor(const char *name, nifi_instance *
instance) {
NULL_CHECK(nullptr, name);
auto ptr = ExecutionPlan::createProcessor(name, name);
if (!ptr) {
return nullptr;
}
- if (standalone_instance == nullptr) {
+ if (instance == NULL) {
nifi_port port;
char portnum[] = "98765";
port.port_id = portnum;
- standalone_instance = create_instance("internal_standalone", &port);
+ instance = create_instance("internal_standalone", &port);
}
- auto flow = create_new_flow(standalone_instance);
+ auto flow = create_new_flow(instance);
std::shared_ptr<ExecutionPlan> plan(flow);
plan->addProcessor(ptr, name);
ExecutionPlan::addProcessorWithPlan(ptr->getUUIDStr(), plan);
return static_cast<standalone_processor*>(ptr.get());
}
+void initialize_content_repo(processor_context * ctx) {
+ ctx->initializeContentRepository(get_current_working_directory());
+}
+
+char * get_proc_uuid_from_processor(standalone_processor * proc) {
Review comment:
I would prefer returning const char * and let the caller copy the value in
case he wants.
For example in your testcase you properly leak it:
```
char * uuid = get_proc_uuid_from_processor(proc);
struct processor_params * pp = get_proc_params(uuid);
//Test that two flow file records were created
REQUIRE(pp != NULL);
REQUIRE(pp->ff_list != NULL);
REQUIRE(pp->ff_list->ff_record != NULL);
REQUIRE(flow_files_size(pp->ff_list) == 2);
//Test that the current offset in the file is 8192 bytes
REQUIRE(pp->curr_offset == 8192);
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services