示例#1
0
        internal override JSONNode ToJsonNode()
        {
            JSONArray sources = new JSONArray();

            if (Sources != null)
            {
                foreach (Source s in Sources)
                {
                    sources.Add(null, s.ToJsonNode());
                }
            }
            return(new JSONObject
            {
                [ApiConstants.Retention] = RetentionPolicy.GetString(),
                [ApiConstants.Storage] = StorageType.GetString(),
                [ApiConstants.Discard] = DiscardPolicy.GetString(),
                [ApiConstants.Name] = Name,
                [ApiConstants.Description] = Description,
                [ApiConstants.Subjects] = ToArray(Subjects),
                [ApiConstants.MaxConsumers] = MaxConsumers,
                [ApiConstants.MaxMsgs] = MaxMsgs,
                [ApiConstants.MaxMsgsPerSubject] = MaxMsgsPerSubject,
                [ApiConstants.MaxBytes] = MaxBytes,
                [ApiConstants.MaxAge] = MaxAge.Nanos,
                [ApiConstants.MaxMsgSize] = MaxValueSize,
                [ApiConstants.NumReplicas] = Replicas,
                [ApiConstants.NoAck] = NoAck,
                [ApiConstants.TemplateOwner] = TemplateOwner,
                [ApiConstants.DuplicateWindow] = DuplicateWindow.Nanos,
                [ApiConstants.Placement] = Placement?.ToJsonNode(),
                [ApiConstants.Mirror] = Mirror?.ToJsonNode(),
                [ApiConstants.Sources] = sources,
                // never write sealed
                [ApiConstants.AllowRollupHdrs] = AllowRollup,
                [ApiConstants.DenyDelete] = DenyDelete,
                [ApiConstants.DenyPurge] = DenyPurge
            });
        }