-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Inline endpoint support back into MQTT. Closes GH-603
- Loading branch information
1 parent
e8df04e
commit 471affe
Showing
6 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Using Kafka | ||
|
||
|
||
::: warning | ||
The Kafka transport does not really support the "Requeue" error handling policy in Wolverine. "Requeue" in this case becomes | ||
effectively an inline "Retry" | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/Transports/MQTT/Wolverine.MQTT.Tests/inline_compliance.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Shouldly; | ||
using TestingSupport; | ||
using TestingSupport.Compliance; | ||
using Wolverine.MQTT.Internals; | ||
using Wolverine.Runtime; | ||
|
||
namespace Wolverine.MQTT.Tests; | ||
|
||
public class InlineComplianceFixture : TransportComplianceFixture, IAsyncLifetime | ||
{ | ||
|
||
public static int Number = 0; | ||
|
||
public InlineComplianceFixture() : base(new Uri("mqtt://topic/receiver"), 120) | ||
{ | ||
|
||
} | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
var port = PortFinder.GetAvailablePort(); | ||
|
||
var number = ++Number; | ||
var receiverTopic = "receiver-" + number; | ||
var senderTopic = "sender-" + number; | ||
|
||
Broker = new LocalMqttBroker(port) | ||
{ | ||
|
||
}; | ||
|
||
await Broker.StartAsync(); | ||
|
||
OutboundAddress = new Uri("mqtt://topic/" + receiverTopic); | ||
|
||
await SenderIs(opts => | ||
{ | ||
opts.UseMqttWithLocalBroker(port); | ||
|
||
opts.ListenToMqttTopic(senderTopic).RetainMessages(); | ||
|
||
opts.PublishAllMessages().ToMqttTopic(receiverTopic).RetainMessages().SendInline(); | ||
}); | ||
|
||
await ReceiverIs(opts => | ||
{ | ||
opts.UseMqttWithLocalBroker(port); | ||
|
||
opts.ListenToMqttTopic(receiverTopic).Named("receiver").RetainMessages().ProcessInline(); | ||
}); | ||
} | ||
|
||
public LocalMqttBroker Broker { get; private set; } | ||
|
||
public async Task DisposeAsync() | ||
{ | ||
await Broker.StopAsync(); | ||
await Broker.DisposeAsync(); | ||
await DisposeAsync(); | ||
} | ||
} | ||
|
||
[Collection("acceptance")] | ||
public class InlineSendingAndReceivingCompliance : TransportCompliance<InlineComplianceFixture> | ||
{ | ||
[Fact] | ||
public void has_response_topic_automatically() | ||
{ | ||
var options = theSender.Services.GetRequiredService<IWolverineRuntime>().Options; | ||
var transport = options.Transports | ||
.GetOrCreate<MqttTransport>(); | ||
|
||
transport.ResponseTopic.ShouldBe("wolverine/response/" + options.Durability.AssignedNodeNumber); | ||
|
||
transport.ReplyEndpoint().ShouldBeOfType<MqttTopic>().TopicName.ShouldBe(transport.ResponseTopic); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters