-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for AMQP protocol over WebSockets
- Loading branch information
Showing
10 changed files
with
94 additions
and
13 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
namespace ActiveMQ.Artemis.Client | ||
{ | ||
/// <summary> | ||
/// Represents the protocol schemes used for AMQP connections. | ||
/// </summary> | ||
public enum Scheme | ||
{ | ||
/// <summary> | ||
/// Represents the standard AMQP protocol without security. | ||
/// </summary> | ||
Amqp, | ||
Amqps | ||
|
||
/// <summary> | ||
/// Represents the standard AMQP protocol secured with SSL/TLS. | ||
/// </summary> | ||
Amqps, | ||
|
||
/// <summary> | ||
/// Represents the AMQP protocol over WebSocket without security. | ||
/// </summary> | ||
Ws, | ||
|
||
/// <summary> | ||
/// Represents the AMQP protocol over WebSocket secured with SSL/TLS. | ||
/// </summary> | ||
Wss | ||
} | ||
} |
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,38 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ActiveMQ.Artemis.Client.IntegrationTests; | ||
|
||
public class WebSocketsSpec : ActiveMQNetIntegrationSpec | ||
{ | ||
public WebSocketsSpec(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task Should_send_and_receive_message_with_web_socket_endpoint() | ||
{ | ||
string userName = Environment.GetEnvironmentVariable("ARTEMIS_USERNAME") ?? "artemis"; | ||
string password = Environment.GetEnvironmentVariable("ARTEMIS_PASSWORD") ?? "artemis"; | ||
string host = Environment.GetEnvironmentVariable("ARTEMIS_HOST") ?? "localhost"; | ||
int port = int.Parse(Environment.GetEnvironmentVariable("ARTEMIS_WS_PORT") ?? "80"); | ||
|
||
var endpoint = Endpoint.Create(host: host, port: port, user: userName, password: password, Scheme.Ws); | ||
|
||
var address = Guid.NewGuid().ToString(); | ||
|
||
var connectionFactory = new ConnectionFactory(); | ||
await using var connection = await connectionFactory.CreateAsync(endpoint, CancellationToken); | ||
await using var consumer = await connection.CreateConsumerAsync(address, RoutingType.Anycast); | ||
await using var producer = await connection.CreateProducerAsync(address, RoutingType.Anycast); | ||
|
||
await producer.SendAsync(new Message("msg")); | ||
|
||
var msg = await consumer.ReceiveAsync(); | ||
await consumer.AcceptAsync(msg); | ||
|
||
Assert.Equal("msg", msg.GetBody<string>()); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ services: | |
ports: | ||
- 5672:5672 | ||
- 8161:8161 | ||
- 80:80 | ||
volumes: | ||
- ./broker.xml:/artemis/amq/etc/broker.xml |