public static void Publish(object obj) { byte[] received = StreamConversion.ObjectToByteArray(obj); _publisher.PublishEvent((entry, sequenceNo) => { //copy byte to diruptor ring byte Buffer.BlockCopy(received, 0, entry, 0, received.Length); return(entry); }); }
/// <summary> /// Deep copy /// </summary> /// <returns></returns> public object Clone() { // using (MemoryStream stream = new MemoryStream()) //{ if (this.GetType().IsSerializable) { return(StreamConversion.ByteArrayToObject(StreamConversion.ObjectToByteArray(this))); } return(null); // } }
/// <summary> /// Save Exchange snapshot /// </summary> /// <param name="exchangeEssentials"></param> public void SaveSnapshot(ExchangeEssentialsList exchangeEssentials) { if (_eventStore == Constants.OUTPUT_EVENT_STORE) { try { _store.Advanced.AddSnapshot(new Snapshot(_streamId, _snaphost++, StreamConversion.ObjectToByteArray(exchangeEssentials))); } catch (Exception exception) { if (Log.IsErrorEnabled) { Log.Error("Snapshot Saving error:", exception); } } } }