-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement the Filter chunk feature * Check if the broker supports the broker filter. * Check if the broker is >= 3.11.0 to validate the exchange version * Add AvailableFeatures singleton to test check features Signed-off-by: Gabriele Santomaggio <[email protected]>
- Loading branch information
1 parent
2f1be23
commit 79f56db
Showing
35 changed files
with
1,138 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"erlang": "25.3", | ||
"rabbitmq": "3.11.11" | ||
"rabbitmq": "3.13.0-beta.3" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This source code is dual-licensed under the Apache License, version | ||
// 2.0, and the Mozilla Public License, version 2.0. | ||
// Copyright (c) 2007-2023 VMware, Inc. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace RabbitMQ.Stream.Client; | ||
|
||
/// <summary> | ||
/// AvailableFeatures holds the features enabled by the server and the client. | ||
/// </summary> | ||
internal class AvailableFeatures | ||
{ | ||
public bool PublishFilter { get; private set; } | ||
|
||
public bool Is311OrMore { get; private set; } | ||
|
||
private static string ExtractVersion(string fullVersion) | ||
{ | ||
const string Pattern = @"(\d+\.\d+\.\d+)"; | ||
var match = Regex.Match(fullVersion, Pattern); | ||
|
||
return match.Success | ||
? match.Groups[1].Value | ||
: string.Empty; | ||
} | ||
|
||
public void SetServerVersion(string brokerVersion) | ||
{ | ||
var v = ExtractVersion(brokerVersion); | ||
Is311OrMore = new System.Version(v) >= new System.Version("3.11.0"); | ||
} | ||
|
||
public void ParseCommandVersions(List<ICommandVersions> commands) | ||
{ | ||
foreach (var command in commands) | ||
{ | ||
switch (command.Command) | ||
{ | ||
case Stream.Client.PublishFilter.Key: | ||
var p = new PublishFilter(); | ||
PublishFilter = command.MinVersion <= p.MinVersion && | ||
command.MaxVersion >= p.MaxVersion; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
internal sealed class AvailableFeaturesSingleton | ||
{ | ||
private static readonly Lazy<AvailableFeatures> s_lazy = | ||
new(() => new AvailableFeatures()); | ||
|
||
public static AvailableFeatures Instance => s_lazy.Value; | ||
} |
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
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
Oops, something went wrong.