dff3000461
Port 46 deferred features from server/events.go covering the internal event system foundation: - Group A (EventHelpers.cs): NewPubMsg/pool, RouteStat, GetHash/GetHashSize, GetAcceptEncoding, RemoteLatencySubjectForResponse, TotalSubs, AccForClient, IssuerForClient, ClearTimer; CompressionType enum - Group B (NatsServerTypes.cs): ServerInfo advisory fields (Seq, Time, Capabilities, Tags, Metadata) + capability methods (SetJetStreamEnabled, IsJetStreamEnabled, SetBinaryStreamSnapshot, IsBinaryStreamSnapshot, SetAccountNrg, IsAccountNrg) - Group C (ClientTypes.cs): ForAssignmentSnap, ForProposal, ForAdvisory on ClientInfo - Group D (EventTypes.cs): PubMsg.ReturnToPool; PubMsg.Client typed as ClientConnection?; InternalState.Client typed as ClientConnection?; InternalState.Seq changed to long field for Interlocked.Increment - Group E (ClientConnection.Events.cs): SendInternalMsg delegates to server - Group F (Account.Events.cs): AccountTrafficStats/Set + Account.Statz() - Group G (NatsServer.Events.cs): InternalReceiveLoop, InternalSendLoop, SendShutdownEvent, SendInternalAccountSysMsg, SendInternalMsgLocked, SendInternalMsg, SendInternalMsgFromClient, SendInternalResponse, EventsRunning, EventsEnabled, Node, InitEventTracking, FilterRequest, NoInlineCallback*, SysSubscribe*, SystemSubscribe, SysUnsubscribe, InboxReply, NewRespInbox, WrapChk; EventFilterOptions, ServerApiResponse, ApiError types - Subscription.SysMsgCb field added for system subscription dispatch
41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
// Copyright 2012-2026 The NATS Authors
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
// Adapted from server/events.go (client.sendInternalMsg) in the NATS server Go source.
|
|
|
|
namespace ZB.MOM.NatsNet.Server;
|
|
|
|
public sealed partial class ClientConnection
|
|
{
|
|
// =========================================================================
|
|
// Group E: sendInternalMsg from a client context
|
|
// =========================================================================
|
|
|
|
/// <summary>
|
|
/// Sends an internal message from this client's context, avoiding no-echo issues
|
|
/// when the message originates from a non-system client.
|
|
/// Mirrors Go <c>(c *client) sendInternalMsg(...)</c> in server/events.go.
|
|
/// </summary>
|
|
internal void SendInternalMsg(
|
|
string subject,
|
|
string reply,
|
|
ServerInfo? si,
|
|
object? msg)
|
|
{
|
|
var srv = Server as NatsServer;
|
|
if (srv is null) return;
|
|
|
|
srv.SendInternalMsgFromClient(this, subject, reply, si, msg);
|
|
}
|
|
}
|