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

1.5.0/latest #13

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open

1.5.0/latest #13

wants to merge 35 commits into from

Conversation

ileinone
Copy link

Please review changes including

  • Batch processing of the messages
  • Transaction management

@ileinone
Copy link
Author

Transmission of messages within:

  • Transaction scope

  • Batch scope

@ileinone ileinone closed this Aug 24, 2020
@ileinone ileinone reopened this Aug 24, 2020
Copy link

@EkiH EkiH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library is not thread safe, the connection setup/disconnect should be protected with a lock. The Task also only supports a connection to one host at a time which should be documented. Although not too probable, someone might try to use it to connect to multiple separate RabbitMQs concurrently.

Frends.Community.RabbitMQ/Frends.Community.RabbitMQ.csproj Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/Definitions.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/MessageCompressor.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/MessageCompressor.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
@ileinone ileinone changed the base branch from FCOM_224 to master August 27, 2020 08:19
Frends.Community.RabbitMQ/Definitions.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/Definitions.cs Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved
Frends.Community.RabbitMQ/RabbitMQTask.cs Outdated Show resolved Hide resolved

return true;
// Commit under transaction when all of the messages have been received for the producer.
if (channel.MessageCount(inputParams.QueueName) == inputParams.WriteMessageCount)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using message counts for specifying when to commit a message seems a bit error prone. It would be better to have a separate Task for committing the batch.

CreateBasicPublishBatch(inputParams.ProcessExecutionId, channel).Publish();
channel.TxCommit();

if (channel.MessageCount(inputParams.QueueName) > 0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rollback here, isn't the transaction committed right above this and rolling back here would have no effect or throw an error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there are messages left in the bounded context all messages needs to be rollbacked.

@@ -2,4 +2,5 @@
<packages>
<package id="Microsoft.Diagnostics.Tracing.EventSource.Redist" version="1.1.28" targetFramework="net452" />
<package id="RabbitMQ.Client" version="5.1.0" targetFramework="net452" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net452" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed as the compression was removed?

@@ -30,6 +30,8 @@ Tasks
| ExchangeName | string | Name of the exchange | sampleExchange |
| RoutingKey | string | Routing key (as in RabbitMQ specification) | sampleQueue |
| HostName | string | Address of the server hosting RabbitMQ | localhost or amqp://user:password@hostname:port/vhost |
| WriteMessageCount | string | Amount of messages in the buffer which will be sent over messaging queue as a batch. | 20 |
| ProcessExecutionId | string | Unique id of the process execution. | igbmdajlskdhlfjaeirjwkdjfasdflht |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably instruct the user to use #process.executionid

@@ -43,6 +45,7 @@ Tasks
| RoutingKey | string | Routing key (as in RabbitMQ specification) | sampleQueue |
| HostName | string | Address of the server hosting RabbitMQ | localhost or amqp://user:password@hostname:port/vhost |
| ConnectWithURI | bool | If true, hostname should be an URI | If false, use hostname only |
| ProcessExecutionId | string | Unique id of the process execution. | igbmdajlskdhlfjaeirjwkdjfasdflht |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably instruct the user to use #process.executionid

@@ -30,6 +30,8 @@ Tasks
| ExchangeName | string | Name of the exchange | sampleExchange |
| RoutingKey | string | Routing key (as in RabbitMQ specification) | sampleQueue |
| HostName | string | Address of the server hosting RabbitMQ | localhost or amqp://user:password@hostname:port/vhost |
| WriteMessageCount | string | Amount of messages in the buffer which will be sent over messaging queue as a batch. | 20 |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to use the WriteMessageCount to signal when the batch should be committed, that should be reflected in the documentation. IMHO it would be more clear to have the separate task for committing the batch instead. This way the functionality isn't "magic" for the user

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

Successfully merging this pull request may close these issues.

3 participants