A serializer wrapper for a linq expression tree payload
 /// <summary>
 /// Sends the specified methods to be executed.
 /// </summary>
 /// <param name="methods">The methods to execute.</param>
 /// <returns></returns>
 public IQueueOutputMessages Send(List<QueueMessage<Expression<Action<IReceivedMessage<MessageExpression>, IWorkerNotification>>, IAdditionalMessageData>> methods)
 {
     var messages = new List<QueueMessage<MessageExpression, IAdditionalMessageData>>(methods.Count);
     foreach (var method in methods)
     {
         var message = new MessageExpression(MessageExpressionPayloads.Action,  _serializer.ConvertMethodToBytes(method.Message));
         messages.Add(new QueueMessage<MessageExpression, IAdditionalMessageData>(message, method.MessageData));
     }
     return _queue.Send(messages);
 }
Esempio n. 2
0
 /// <summary>
 /// Sends the specified linqExpression for execution.
 /// </summary>
 /// <param name="linqExpression">The linqExpression.</param>
 /// <param name="timeOut">The time out.</param>
 /// <param name="data">The data.</param>
 /// <returns></returns>
 /// <remarks>Your expression must return a type of object, or the JSON serializer may throw casting errors</remarks>
 public async Task<IReceivedMessage<object>> SendAsync(LinqExpressionToRun linqExpression, TimeSpan timeOut,
     IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.FunctionText, _compositeSerialization.InternalSerializer.ConvertToBytes(linqExpression));
     return await _queue.SendAsync(message, timeOut, data).ConfigureAwait(false);
 }
Esempio n. 3
0
 /// <summary>
 /// Sends the specified linqExpression for execution.
 /// </summary>
 /// <param name="linqExpression">The linqExpression.</param>
 /// <param name="timeOut">The time out.</param>
 /// <param name="data">The data.</param>
 /// <returns></returns>
 /// <remarks>Your expression must return a type of object, or the JSON serializer may throw casting errors</remarks>
 public IReceivedMessage<object> Send(LinqExpressionToRun linqExpression, TimeSpan timeOut, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.FunctionText, _compositeSerialization.InternalSerializer.ConvertToBytes(linqExpression));
     return _queue.Send(message, timeOut, data);
 }
Esempio n. 4
0
 /// <summary>
 /// Sends the specified linqExpression for execution.
 /// </summary>
 /// <param name="method">The linqExpression.</param>
 /// <param name="timeOut">The time out.</param>
 /// <param name="data">The data.</param>
 /// <returns></returns>
 /// <remarks>
 /// Your expression must return a type of object, or the JSON serializer may throw casting errors
 /// </remarks>
 public async Task<IReceivedMessage<object>> SendAsync(Expression<Func<IReceivedMessage<MessageExpression>, IWorkerNotification, object>> method, TimeSpan timeOut, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.Function, _serializer.ConvertFunctionToBytes(method));
     return await _queue.SendAsync(message, timeOut, data).ConfigureAwait(false);
 }
Esempio n. 5
0
 /// <summary>
 /// Sends the specified linqExpression for execution.
 /// </summary>
 /// <param name="method">The linqExpression.</param>
 /// <param name="timeOut">The time out.</param>
 /// <param name="data">The data.</param>
 /// <returns></returns>
 /// <remarks>
 /// Your expression must return a type of object, or the JSON serializer may throw casting errors
 /// </remarks>
 public IReceivedMessage<object> Send(Expression<Func<IReceivedMessage<MessageExpression>, IWorkerNotification, object>> method, TimeSpan timeOut, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.Function, _serializer.ConvertFunctionToBytes(method));
     return _queue.Send(message, timeOut, data);
 }
 /// <summary>
 /// Sends the specified linqExpression to be executed. Additional message meta data is optional.
 /// </summary>
 /// <param name="method">The linqExpression to execute.</param>
 /// <param name="data">The optional additional message data.</param>
 /// <returns></returns>
 public async Task<IQueueOutputMessage> SendAsync(Expression<Action<IReceivedMessage<MessageExpression>, IWorkerNotification>> method, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.Action, _serializer.ConvertMethodToBytes(method));
     return await _queue.SendAsync(message, data).ConfigureAwait(false);
 }
 /// <summary>
 /// Sends the specified methods to be executed.
 /// </summary>
 /// <param name="methods">The messages.</param>
 /// <returns></returns>
 public async Task<IQueueOutputMessages> SendAsync(List<QueueMessage<LinqExpressionToRun, IAdditionalMessageData>> methods)
 {
     var messages = new List<QueueMessage<MessageExpression, IAdditionalMessageData>>(methods.Count);
     foreach (var method in methods)
     {
         var message = new MessageExpression(MessageExpressionPayloads.ActionText, _compositeSerialization.InternalSerializer.ConvertToBytes(method));
         messages.Add(new QueueMessage<MessageExpression, IAdditionalMessageData>(message, method.MessageData));
     }
     return await _queue.SendAsync(messages).ConfigureAwait(false);
 }
 /// <summary>
 /// Sends the specified linqExpression to be executed. Additional message meta data is optional.
 /// </summary>
 /// <param name="linqExpression">The linqExpression to execute.</param>
 /// <param name="data">The optional additional message data.</param>
 /// <returns></returns>
 public async Task<IQueueOutputMessage> SendAsync(LinqExpressionToRun linqExpression, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.ActionText, _compositeSerialization.InternalSerializer.ConvertToBytes(linqExpression));
     return await _queue.SendAsync(message, data).ConfigureAwait(false);
 }
 /// <summary>
 /// Sends the specified linqExpression to be executed. Additional message meta data is optional.
 /// </summary>
 /// <param name="linqExpression">The linqExpression to execute.</param>
 /// <param name="data">The optional additional message data.</param>
 /// <returns></returns>
 public IQueueOutputMessage Send(LinqExpressionToRun linqExpression, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.ActionText,
         _compositeSerialization.InternalSerializer.ConvertToBytes(linqExpression));
     return _queue.Send(message, data);
 }
 /// <summary>
 /// Sends the specified linqExpression to be executed. Additional message meta data is optional.
 /// </summary>
 /// <param name="method">The linqExpression to execute.</param>
 /// <param name="data">The optional additional message data.</param>
 /// <returns></returns>
 public IQueueOutputMessage Send(Expression<Action<IReceivedMessage<MessageExpression>, IWorkerNotification>> method, IAdditionalMessageData data = null)
 {
     var message = new MessageExpression(MessageExpressionPayloads.Action, _serializer.ConvertMethodToBytes(method));
     return _queue.Send(message, data);
 }