Ejemplo n.º 1
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Op != null)
                {
                    hash = hash * 59 + Op.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (SegmentationEnabled != null)
                {
                    hash = hash * 59 + SegmentationEnabled.GetHashCode();
                }

                if (Clk != null)
                {
                    hash = hash * 59 + Clk.GetHashCode();
                }

                if (HeartbeatMs != null)
                {
                    hash = hash * 59 + HeartbeatMs.GetHashCode();
                }

                if (InitialClk != null)
                {
                    hash = hash * 59 + InitialClk.GetHashCode();
                }

                if (MarketFilter != null)
                {
                    hash = hash * 59 + MarketFilter.GetHashCode();
                }

                if (ConflateMs != null)
                {
                    hash = hash * 59 + ConflateMs.GetHashCode();
                }

                if (MarketDataFilter != null)
                {
                    hash = hash * 59 + MarketDataFilter.GetHashCode();
                }

                return(hash);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Returns true if OrderSubscriptionMessage instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderSubscriptionMessage to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderSubscriptionMessage other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Op == other.Op || Op != null && Op.Equals(other.Op)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (SegmentationEnabled == other.SegmentationEnabled || SegmentationEnabled != null && SegmentationEnabled.Equals(other.SegmentationEnabled)) &&
                   (OrderFilter == other.OrderFilter || OrderFilter != null && OrderFilter.Equals(other.OrderFilter)) &&
                   (Clk == other.Clk || Clk != null && Clk.Equals(other.Clk)) &&
                   (HeartbeatMs == other.HeartbeatMs || HeartbeatMs != null && HeartbeatMs.Equals(other.HeartbeatMs)) &&
                   (InitialClk == other.InitialClk || InitialClk != null && InitialClk.Equals(other.InitialClk)) &&
                   (ConflateMs == other.ConflateMs || ConflateMs != null && ConflateMs.Equals(other.ConflateMs)));
        }
Ejemplo n.º 3
0
 public Dictionary <string, object> GetConsumerConfig()
 {
     return(new Dictionary <string, object>
     {
         { "auto.commit.interval.ms", AutoCommitInterval.GetValueOrDefault(5000) },
         { "auto.offset.reset", AutoOffsetReset.GetValueOrDefault(Configuration.AutoOffsetReset.Earliest).ToString().ToLower() },
         { "bootstrap.servers", string.Join(",", BootstrapServers) },
         { "client.id", ClientId ?? $"{Assembly.GetEntryAssembly().FullName.ToLower()}-{Environment.MachineName.ToLower()}" },
         { "enable.auto.commit", EnableAutoCommit.GetValueOrDefault(false) },
         { "group.id", GroupId ?? $"{Assembly.GetEntryAssembly().GetName().Name.ToLower()}" },
         { "heartbeat.interval.ms", HeartbeatMs.GetValueOrDefault(3000) },
         { "request.timeout.ms", RequestTimeoutMs.GetValueOrDefault(30000) },
         { "session.timeout.ms", SessionTimeoutMs.GetValueOrDefault(10000) },
         { "debug", DebugContexts ?? "generic" },
         { "log_level", (int)LogLevel.GetValueOrDefault(Configuration.LogLevel.LOG_INFO) }
     });
 }
        /// <summary>
        ///     Returns true if OrderChangeMessage instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderChangeMessage to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderChangeMessage other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Op == other.Op || Op != null && Op.Equals(other.Op)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Ct == other.Ct || Ct != null && Ct.Equals(other.Ct)) &&
                   (Clk == other.Clk || Clk != null && Clk.Equals(other.Clk)) &&
                   (HeartbeatMs == other.HeartbeatMs || HeartbeatMs != null && HeartbeatMs.Equals(other.HeartbeatMs)) &&
                   (Pt == other.Pt || Pt != null && Pt.Equals(other.Pt)) &&
                   (Oc == other.Oc || Oc != null && Oc.SequenceEqual(other.Oc)) &&
                   (InitialClk == other.InitialClk || InitialClk != null && InitialClk.Equals(other.InitialClk)) &&
                   (ConflateMs == other.ConflateMs || ConflateMs != null && ConflateMs.Equals(other.ConflateMs)) &&
                   (SegmentType == other.SegmentType || SegmentType != null && SegmentType.Equals(other.SegmentType)));
        }