lordgamez commented on a change in pull request #1178:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1178#discussion_r719334026
##########
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:
It should not be a problem as onSchedule is only run once and the
onTrigger calls that could be running in parallel may only read that variable.
The mutex is used for protecting the Azure client when multiple onTrigger calls
could reset the client with different parameters while running in parallel.
--
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]