-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
0 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
51 changes: 51 additions & 0 deletions
51
src/ArtemisNetCoreClient/Framing/CreateSessionMessageV2.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,51 @@ | ||
namespace ActiveMQ.Artemis.Core.Client.Framing; | ||
|
||
internal class CreateSessionMessageV2 : Packet | ||
{ | ||
public override byte Type => unchecked((byte) -18); | ||
public required string Name { get; init; } | ||
public long SessionChannelId { get; init; } | ||
public int Version { get; init; } | ||
public string? Username { get; init; } | ||
public string? Password { get; init; } | ||
public int MinLargeMessageSize { get; init; } | ||
public bool Xa { get; init; } | ||
public bool AutoCommitSends { get; init; } | ||
public bool AutoCommitAcks { get; init; } | ||
public bool PreAcknowledge { get; init; } | ||
public int WindowSize { get; init; } | ||
public string? DefaultAddress { get; init; } | ||
public string? ClientId { get; init; } | ||
public long ChannelId { get; init; } | ||
|
||
public override void Encode(ByteBuffer buffer) | ||
{ | ||
// header | ||
buffer.WriteInt(0); // The length gets filled in at the end | ||
buffer.WriteByte(Type); | ||
buffer.WriteLong(ChannelId); | ||
|
||
// rest | ||
buffer.WriteString(Name); | ||
buffer.WriteLong(SessionChannelId); | ||
buffer.WriteInt(Version); | ||
buffer.WriteNullableString(Username); | ||
buffer.WriteNullableString(Password); | ||
buffer.WriteInt(MinLargeMessageSize); | ||
buffer.WriteBool(Xa); | ||
buffer.WriteBool(AutoCommitSends); | ||
buffer.WriteBool(AutoCommitAcks); | ||
buffer.WriteInt(WindowSize); | ||
buffer.WriteBool(PreAcknowledge); | ||
buffer.WriteNullableString(DefaultAddress); | ||
buffer.WriteNullableString(ClientId); | ||
|
||
// size | ||
buffer.WriteSize(); | ||
} | ||
|
||
public override void Decode(ByteBuffer buffer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/ArtemisNetCoreClient/Framing/CreateSessionResponseMessage.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,21 @@ | ||
namespace ActiveMQ.Artemis.Core.Client.Framing; | ||
|
||
internal class CreateSessionResponseMessage : Packet | ||
{ | ||
public long ChannelId { get; private set; } | ||
public int ServerVersion { get; private set; } | ||
|
||
public override byte Type { get; } = 31; | ||
|
||
public override void Encode(ByteBuffer buffer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Decode(ByteBuffer buffer) | ||
{ | ||
_ = buffer.ReadByte(); // type | ||
ChannelId = buffer.ReadLong(); | ||
ServerVersion = buffer.ReadInt(); | ||
} | ||
} |
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,8 @@ | ||
namespace ActiveMQ.Artemis.Core.Client.Framing; | ||
|
||
internal abstract class Packet | ||
{ | ||
public abstract byte Type { get; } | ||
public abstract void Encode(ByteBuffer buffer); | ||
public abstract void Decode(ByteBuffer buffer); | ||
} |