public void OnReceived(int streamIndex, ulong id, ScaleoutMessage message) { _receive(streamIndex, id, message); // We assume if a message has come in then the stream is open Open(streamIndex); }
public ScaleoutMapping(ulong id, ScaleoutMessage message, IList<LocalEventKeyInfo> localKeyInfo) { if (message == null) { throw new ArgumentNullException("message"); } if (localKeyInfo == null) { throw new ArgumentNullException("localKeyInfo"); } Id = id; LocalKeyInfo = localKeyInfo; ServerCreationTime = message.ServerCreationTime; }
public ScaleoutMapping(ulong id, ScaleoutMessage message, IList <LocalEventKeyInfo> localKeyInfo) { if (message == null) { throw new ArgumentNullException("message"); } if (localKeyInfo == null) { throw new ArgumentNullException("localKeyInfo"); } Id = id; LocalKeyInfo = localKeyInfo; ServerCreationTime = message.ServerCreationTime; }
public static ScaleoutMessage FromBytes(byte[] data) { if (data == null) { throw new ArgumentNullException("data"); } using (var stream = new MemoryStream(data)) { var binaryReader = new BinaryReader(stream); var message = new ScaleoutMessage(); message.Messages = new List<Message>(); int count = binaryReader.ReadInt32(); for (int i = 0; i < count; i++) { message.Messages.Add(Message.ReadFrom(stream)); } message.ServerCreationTime = new DateTime(binaryReader.ReadInt64()); return message; } }
public static ScaleoutMessage FromBytes(byte[] data) { if (data == null) { throw new ArgumentNullException("data"); } using (var stream = new MemoryStream(data)) { var binaryReader = new BinaryReader(stream); var message = new ScaleoutMessage(); message.Messages = new List <Message>(); int count = binaryReader.ReadInt32(); for (int i = 0; i < count; i++) { message.Messages.Add(Message.ReadFrom(stream)); } message.ServerCreationTime = new DateTime(binaryReader.ReadInt64()); return(message); } }
private void OnReceivedCore(int streamIndex, ulong id, ScaleoutMessage scaleoutMessage) { Counters.ScaleoutMessageBusMessagesReceivedPerSec.IncrementBy(scaleoutMessage.Messages.Count); _logger.LogInformation(String.Format("OnReceived({0}, {1}, {2})", streamIndex, id, scaleoutMessage.Messages.Count)); var localMapping = new LocalEventKeyInfo[scaleoutMessage.Messages.Count]; var keys = new HashSet <string>(); for (var i = 0; i < scaleoutMessage.Messages.Count; ++i) { Message message = scaleoutMessage.Messages[i]; // Remember where this message came from message.MappingId = id; message.StreamIndex = streamIndex; keys.Add(message.Key); ulong localId = Save(message); MessageStore <Message> messageStore = Topics[message.Key].Store; localMapping[i] = new LocalEventKeyInfo(message.Key, localId, messageStore); } // Get the stream for this payload ScaleoutMappingStore store = StreamManager.Streams[streamIndex]; // Publish only after we've setup the mapping fully store.Add(id, scaleoutMessage, localMapping); // Schedule after we're done foreach (var eventKey in keys) { ScheduleEvent(eventKey); } }
public ScaleoutMapping(ulong id, ScaleoutMessage message) : this(id, message, ListHelper<LocalEventKeyInfo>.Empty) { }
private void OnReceivedCore(int streamIndex, ulong id, ScaleoutMessage scaleoutMessage) { Counters.ScaleoutMessageBusMessagesReceivedPerSec.IncrementBy(scaleoutMessage.Messages.Count); _logger.LogInformation(String.Format("OnReceived({0}, {1}, {2})", streamIndex, id, scaleoutMessage.Messages.Count)); var localMapping = new LocalEventKeyInfo[scaleoutMessage.Messages.Count]; var keys = new HashSet<string>(); for (var i = 0; i < scaleoutMessage.Messages.Count; ++i) { Message message = scaleoutMessage.Messages[i]; // Remember where this message came from message.MappingId = id; message.StreamIndex = streamIndex; keys.Add(message.Key); ulong localId = Save(message); MessageStore<Message> messageStore = Topics[message.Key].Store; localMapping[i] = new LocalEventKeyInfo(message.Key, localId, messageStore); } // Get the stream for this payload ScaleoutMappingStore store = StreamManager.Streams[streamIndex]; // Publish only after we've setup the mapping fully store.Add(id, scaleoutMessage, localMapping); // Schedule after we're done foreach (var eventKey in keys) { ScheduleEvent(eventKey); } }
/// <summary> /// Invoked when a payload is received from the backplane. There should only be one active call at any time. /// </summary> /// <param name="streamIndex">id of the stream.</param> /// <param name="id">id of the payload within that stream.</param> /// <param name="message">The scaleout message.</param> /// <returns></returns> protected virtual void OnReceived(int streamIndex, ulong id, ScaleoutMessage message) { StreamManager.OnReceived(streamIndex, id, message); }
public ScaleoutMapping(ulong id, ScaleoutMessage message) : this(id, message, ListHelper <LocalEventKeyInfo> .Empty) { }