Пример #1
0
 internal DispatchWrapper(IPayloadSerializationContainer serializer, Action <TransmissionPayload, string> executeOrEnqueue
                          , Func <ServiceStatus> getStatus, bool traceEnabled) : base(getStatus)
 {
     ExecuteOrEnqueue = executeOrEnqueue;
     mSerializer      = serializer;
     mTransmissionPayloadTraceEnabled = traceEnabled;
 }
Пример #2
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public OnDataCollectionContext(
     IPayloadSerializationContainer serializer
     , IDataCollection collector
     , ISharedService sharedServices
     , MicroserviceId originatorId
     , IMicroserviceDispatch outgoingRequest) : base(serializer, collector, sharedServices, originatorId, outgoingRequest)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatchWrapper"/> class.
 /// </summary>
 /// <param name="serializer">The serializer.</param>
 /// <param name="executeOrEnqueue">The execute or enqueue action.</param>
 /// <param name="getStatus">The get status function.</param>
 /// <param name="traceEnabled">if set to <c>true</c> trace is enabled for payloads.</param>
 protected internal DispatchWrapper(IPayloadSerializationContainer serializer, Action <TransmissionPayload, string> executeOrEnqueue, Func <ServiceStatus> getStatus, bool traceEnabled)
     : base(getStatus)
 {
     Name                = GetType().Name;
     ExecuteOrEnqueue    = executeOrEnqueue;
     Serialization       = serializer;
     PayloadTraceEnabled = traceEnabled;
 }
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public CommandMethodRequestContext(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                    , IPayloadSerializationContainer serializer
                                    , IDataCollection collector
                                    , ISharedService sharedServices
                                    , MicroserviceId originatorId
                                    , ICommandOutgoing outgoingRequest) : base(rq, rsCol, serializer, collector, sharedServices, originatorId, outgoingRequest)
 {
 }
Пример #5
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="schedule">The incoming schedule.</param>
 /// <param name="token">The cancellation token.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 public CommandScheduleInlineContext(Schedule schedule, CancellationToken token
                                     , IPayloadSerializationContainer serializer
                                     , IDataCollection collector
                                     , ISharedService sharedServices
                                     , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId)
 {
     Schedule = schedule;
     Token    = token;
 }
Пример #6
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 public CommandMethodInlineContext(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                   , IPayloadSerializationContainer serializer
                                   , IDataCollection collector
                                   , ISharedService sharedServices
                                   , MicroserviceId originatorId) : base(serializer, collector, sharedServices, originatorId)
 {
     Request   = rq;
     Responses = rsCol;
 }
Пример #7
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="rq">The incoming request.</param>
 /// <param name="rsCol">The outgoing response collection.</param>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 /// <param name="outgoingRequest">This is the outgoing request initiator.</param>
 public CommandRequestContextBase(TransmissionPayload rq, List <TransmissionPayload> rsCol
                                  , IPayloadSerializationContainer serializer
                                  , IDataCollection collector
                                  , ISharedService sharedServices
                                  , MicroserviceId originatorId
                                  , O outgoingRequest) : base(serializer, collector, sharedServices, originatorId, outgoingRequest)
 {
     Request   = rq;
     Responses = rsCol;
 }
Пример #8
0
 /// <summary>
 /// This method extracts the binary blob from the message and deserializes and returns the object.
 /// </summary>
 /// <typeparam name="P">The payload message type.</typeparam>
 /// <param name="srz">The serialization container.</param>
 /// <param name="message">The service message.</param>
 /// <returns>Returns the object deserialized from the binary blob.</returns>
 public static P PayloadDeserialize <P>(this IPayloadSerializationContainer srz, ServiceMessage message)
 {
     try
     {
         return(srz.PayloadDeserialize <P>(message.Holder));
     }
     catch (Exception ex)
     {
         throw new PayloadSerializationException(message.OriginatorKey, ex);
     }
 }
Пример #9
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="serializer">The serialization container.</param>
 /// <param name="collector">The data collector.</param>
 /// <param name="sharedServices">The shared service context.</param>
 /// <param name="originatorId">This is the Microservice identifiers.</param>
 public CommandContextBase(
     IPayloadSerializationContainer serializer
     , IDataCollection collector
     , ISharedService sharedServices
     , MicroserviceId originatorId)
 {
     PayloadSerializer = serializer;
     Collector         = collector;
     SharedServices    = sharedServices;
     OriginatorId      = originatorId;
 }
Пример #10
0
 internal CommandHarnessDispatchWrapper(CommandPolicy policy
                                        , IPayloadSerializationContainer serializer
                                        , Action <TransmissionPayload, string> executeOrEnqueue
                                        , Func <ServiceStatus> getStatus
                                        , bool traceEnabled
                                        , string originatorServiceId = null)
     : base(serializer, executeOrEnqueue, getStatus, traceEnabled)
 {
     DefaultOriginatorServiceId = originatorServiceId;
     Policy = policy;
 }
        /// <summary>
        /// This method tries to extract an entity from the message if present.
        /// </summary>
        /// <param name="srz">The serialization container.</param>
        /// <param name="message">The service message.</param>
        /// <param name="entity">The deserialized entity</param>
        /// <returns>Returns true if the message is present.</returns>
        public static bool PayloadTryDeserialize(this IPayloadSerializationContainer srz, ServiceMessage message, out object entity)
        {
            entity = null;
            if (message?.Blob == null)
            {
                return(false);
            }

            entity = srz.PayloadDeserialize(message);

            return(true);
        }
Пример #12
0
        /// <summary>
        /// This method tries to extract an entity from the message if present.
        /// </summary>
        /// <typeparam name="P">The payload message type.</typeparam>
        /// <param name="srz">The serialization container.</param>
        /// <param name="payload">The transmission payload.</param>
        /// <param name="entity">The deserialized entity</param>
        /// <returns>Returns true if the message is present.</returns>
        public static bool PayloadTryDeserialize <P>(this IPayloadSerializationContainer srz, TransmissionPayload payload, out P entity)
        {
            entity = default(P);
            if (payload?.Message?.Holder == null)
            {
                return(false);
            }

            entity = srz.PayloadDeserialize <P>(payload);

            return(true);
        }
Пример #13
0
        /// <summary>
        /// This method tries to extract an entity from the message if present.
        /// </summary>
        /// <typeparam name="P">The payload message type.</typeparam>
        /// <param name="srz">The serialization container.</param>
        /// <param name="message">The service message.</param>
        /// <param name="entity">The deserialized entity</param>
        /// <returns>Returns true if the message is present.</returns>
        public static bool PayloadTryDeserialize <P>(this IPayloadSerializationContainer srz, ServiceMessage message, out P entity)
        {
            entity = default(P);
            if (message?.Holder == null)
            {
                return(false);
            }

            entity = srz.PayloadDeserialize <P>(message);

            return(true);
        }
        /// <summary>
        /// This method tries to extract an entity from the message if present.
        /// </summary>
        /// <param name="srz">The serialization container.</param>
        /// <param name="payload">The transmission payload.</param>
        /// <param name="entity">The deserialized entity</param>
        /// <returns>Returns true if the message is present.</returns>
        public static bool PayloadTryDeserialize(this IPayloadSerializationContainer srz, TransmissionPayload payload, out object entity)
        {
            entity = null;
            if (payload?.Message?.Blob == null)
            {
                return(false);
            }

            entity = srz.PayloadDeserialize(payload);

            return(true);
        }
Пример #15
0
        /// <summary>
        /// This method extracts the binary blob from the message and deserializes and returns the object.
        /// </summary>
        /// <param name="srz">The serialization container.</param>
        /// <param name="message">The service message.</param>
        /// <returns>Returns the object deserialized from the binary blob.</returns>
        public static object PayloadDeserialize(this IPayloadSerializationContainer srz, ServiceMessage message)
        {
            try
            {
                if (message.Holder?.Blob == null)
                {
                    return(null);
                }

                return(srz.PayloadDeserialize(message.Holder));
            }
            catch (Exception ex)
            {
                throw new PayloadDeserializationException(message.OriginatorKey, ex);
            }
        }
 public static S PayloadUnpack <S>(this TransmissionPayload incoming, IPayloadSerializationContainer c)
 {
     return(c.PayloadDeserialize <S>(incoming.Message.Blob));
 }
 public static void PayloadPack(this TransmissionPayload incoming, IPayloadSerializationContainer c)
 {
     incoming.Message.Blob = c.PayloadSerialize(incoming.MessageObject);
 }
 public static void PayloadPack <O>(this TransmissionPayload incoming, IPayloadSerializationContainer c, O data)
 {
     incoming.Message.Blob = c.PayloadSerialize(data);
 }
Пример #19
0
 /// <summary>
 /// This method extracts the binary blob from the message and deserializes and returns the object.
 /// </summary>
 /// <typeparam name="P">The payload message type.</typeparam>
 /// <param name="srz">The serialization container.</param>
 /// <param name="payload">The transmission payload.</param>
 /// <returns>Returns the object deserialized from the binary blob.</returns>
 public static P PayloadDeserialize <P>(this IPayloadSerializationContainer srz, TransmissionPayload payload)
 {
     return(srz.PayloadDeserialize <P>(payload.Message));
 }