martinzink commented on a change in pull request #1178:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1178#discussion_r719347416
##########
File path: extensions/azure/processors/PutAzureBlobStorage.cpp
##########
@@ -179,53 +232,43 @@ void PutAzureBlobStorage::onTrigger(const
std::shared_ptr<core::ProcessContext>
return;
}
- auto connection_string = getConnectionString(context, flow_file);
- if (connection_string.empty()) {
- logger_->log_error("Connection string is empty!");
- session->transfer(flow_file, Failure);
- return;
- }
-
- std::string container_name;
- if (!context->getProperty(ContainerName, container_name, flow_file) ||
container_name.empty()) {
- logger_->log_error("Container Name is invalid or empty!");
- session->transfer(flow_file, Failure);
- return;
- }
-
- std::string blob_name;
- if (!context->getProperty(Blob, blob_name, flow_file) || blob_name.empty()) {
- logger_->log_error("Blob name is invalid or empty!");
+ auto params = buildAzureBlobStorageParameters(context, flow_file);
+ if (!params) {
session->transfer(flow_file, Failure);
return;
}
std::optional<storage::UploadBlobResult> upload_result;
{
// TODO(lordgamez): This can be removed after maximum allowed threads are
implemented. See https://issues.apache.org/jira/browse/MINIFICPP-1566
+ // When used in multithreaded environment make sure to use the
azure_storage_mutex_ to lock the wrapper so the
+ // client is not reset with different configuration while another thread
is using it.
std::lock_guard<std::mutex> lock(azure_storage_mutex_);
- createAzureStorageClient(connection_string, container_name);
if (create_container_) {
Review comment:
Yeah I see your point, however onSchedule is on the public interface (so
in theory anyone could call that) and the overhead from the mutex would be
non-existent (onSchedule is rarely called) so I would still prefer if it was
protected as well, purely for object oriented principles. But I am not hell
bent on that.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]