public static string ContinueWith <T>( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, JobContinuationOptions options) { return(ContinueJobWith(parentId, methodCall, options)); }
public string Schedule([NotNull, InstantHandle] Expression <Action> action, DateTime enqueueAt, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var state = new ScheduledState(enqueueAt); return(CreateSubatomInternal(action, state, atomProgress)); }
public string Enqueue([NotNull, InstantHandle] Expression <Action> action, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var state = new EnqueuedState(); return(CreateSubatomInternal(action, state, atomProgress)); }
public static string ContinueWith <T>( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Func <T, Task> > methodCall, JobContinuationOptions options = JobContinuationOptions.OnlyOnSucceededState) { return(ContinueJobWith(parentId, methodCall, options)); }
public string Schedule([NotNull, InstantHandle] Expression <Func <Task> > action, TimeSpan enqueueIn, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var state = new ScheduledState(enqueueIn); return(CreateSubatomInternal(action, state, atomProgress)); }
public string Enqueue( [InstantHandle] Expression <Func <Task> > action, IState state, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { return(CreateSubatomInternal(action, state, atomProgress)); }
public string OnTriggerSet(string triggerName, [NotNull, InstantHandle] Expression <Func <Task> > action, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var state = new TriggerWaitingState(triggerName); return(CreateSubatomInternal(action, state, atomProgress)); }
/// <summary> /// Creates a new background job that will wait for another background job to be triggered /// in the <see cref="EnqueuedState"/>. /// </summary> /// <param name="client">A job client instance.</param> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, JobContinuationOptions options) { return(ContinueWith(client, parentId, methodCall, new EnqueuedState(), options)); }
public string ContinueJobWith <T>( string parentId, [InstantHandle] Expression <Action <T> > action, JobContinuationOptions jobContinuationOptions = JobContinuationOptions.OnlyOnSucceededState, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { return(ContinueJobWith(parentId, action, new EnqueuedState(), jobContinuationOptions, atomProgress)); }
public string ContinueJobWith(string parentId, [NotNull, InstantHandle] Expression <Func <Task> > action, JobContinuationOptions continuationOptions = JobContinuationOptions.OnlyOnSucceededState, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var state = new AwaitingState(parentId, new EnqueuedState(), continuationOptions); return(CreateSubatomInternal(action, state, atomProgress)); }
public string Enqueue <T>( [InstantHandle] Expression <Action <T> > action, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var job = Job.FromExpression(action); var nextState = new EnqueuedState(); return(CreateSubatomInternal(job, nextState, atomProgress)); }
/// <summary> /// Creates a new background job that will wait for another background job to be enqueued. /// </summary> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options. By default, /// <see cref="JobContinuationOptions.OnlyOnSucceededState"/> is used.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueJobWith( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Func <Task> > methodCall, JobContinuationOptions options = JobContinuationOptions.OnlyOnSucceededState) { var client = ClientFactory(); return(client.ContinueJobWith(parentId, methodCall, options: options)); }
/// <summary> /// Execute the command only once but when its parent job has been finished. /// </summary> /// <param name="request">Request to be send.</param> /// <param name="parentJobId">Parent job id.</param> /// <param name="continuationOption">Continuation option.</param> /// <returns>Unique identifier of a created job.</returns> public string SendCommand(IRequest request, string parentJobId, JobContinuationOptions continuationOption) { CheckIfOperationIsSupported(); var mediatorSerializedObject = SerializeObject(request); return(BackgroundJob.ContinueJobWith(parentJobId, () => _messageExecutor.ExecuteCommand(mediatorSerializedObject), continuationOption)); }
/// <summary> /// Creates a new background job that will wait for another background job to be enqueued. /// </summary> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueJobWith <T>( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, JobContinuationOptions options) { var client = ClientFactory(); return(client.ContinueJobWith(parentId, methodCall, options)); }
public static string ContinueWith( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [InstantHandle] Expression <Action> methodCall, [NotNull] IState nextState, JobContinuationOptions options) { return(ContinueJobWith(client, parentId, methodCall, nextState, options)); }
public static string ContinueWith <T>( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [NotNull, InstantHandle] Expression <Func <T, Task> > methodCall, [CanBeNull] IState nextState = null, JobContinuationOptions options = JobContinuationOptions.OnlyOnSucceededState) { return(ContinueJobWith(client, parentId, methodCall, nextState, options)); }
public string Enqueue <T>( [InstantHandle] Expression <Func <T, Task> > action, IState state, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var job = Job.FromExpression(action); return(CreateSubatomInternal(job, state, atomProgress)); }
protected string CreateSubatomInternal( Job job, IState nextState, JobContinuationOptions continuationOptions) { var jobId = _client.Create(job, new SubAtomCreatedState(_atomId, nextState, continuationOptions)); _createdSubAtoms.Add(jobId, nextState); return(jobId); }
/// <summary> /// Creates a new background job that will wait for another background job to be enqueued. /// </summary> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options.</param> /// <param name="continuationQueueName">The name of the queue to place the continuation job in. /// This value overrides <see cref="QueueAttribute"/>.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, JobContinuationOptions options, [CanBeNull] string continuationQueueName = null) { var client = ClientFactory(); return(client.ContinueWith(parentId, methodCall, options, continuationQueueName)); }
/// <summary> /// Creates a new background job that will wait for another background job to be enqueued. /// </summary> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options. By default, /// <see cref="JobContinuationOptions.OnlyOnSucceededState"/> is used.</param> /// <param name="continuationQueueName">The name of the queue to place the continuation job in. /// This value overrides <see cref="QueueAttribute"/>.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] string parentId, [NotNull, InstantHandle] Expression <Func <T, Task> > methodCall, JobContinuationOptions options = JobContinuationOptions.OnlyOnSucceededState, [CanBeNull] string continuationQueueName = null) { var client = ClientFactory(); return(client.ContinueWith(parentId, methodCall, options: options, continuationQueueName: continuationQueueName)); }
public string ContinueJobWith( string parentId, [InstantHandle] Expression <Func <Task> > action, IState state, JobContinuationOptions jobContinuationOptions = JobContinuationOptions.OnlyOnSucceededState, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var nextState = new AwaitingState(parentId, state, jobContinuationOptions); return(CreateSubatomInternal(action, nextState, atomProgress)); }
public string ContinueJobWith <T>( string parentId, [InstantHandle] Expression <Action <T> > action, JobContinuationOptions jobContinuationOptions = JobContinuationOptions.OnlyOnSucceededState, JobContinuationOptions atomProgress = JobContinuationOptions.OnlyOnSucceededState) { var job = Job.FromExpression(action); var nextState = new AwaitingState(parentId, new EnqueuedState(), jobContinuationOptions); return(CreateSubatomInternal(job, nextState, atomProgress)); }
public AwaitingState( [NotNull] string parentId, [NotNull] IState nextState, JobContinuationOptions options, TimeSpan expiration) { if (parentId == null) throw new ArgumentNullException("parentId"); if (nextState == null) throw new ArgumentNullException("nextState"); ParentId = parentId; NextState = nextState; Options = options; Expiration = expiration; }
/// <summary> /// Creates a new background job that will wait for another background job to be triggered /// in the <see cref="EnqueuedState"/>. /// </summary> /// <param name="client">A job client instance.</param> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="options">Continuation options.</param> /// <param name="continuationQueueName">The name of the queue to place the continuation job in. /// This value overrides <see cref="QueueAttribute"/>.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, JobContinuationOptions options, [CanBeNull] string continuationQueueName = null) { if (continuationQueueName != null) { return(ContinueWith(client, parentId, methodCall, new EnqueuedState(continuationQueueName), options)); } var job = Job.FromExpression(methodCall); return(ContinueWith(client, parentId, methodCall, new EnqueuedState(job.QueueName), options)); }
/// <summary> /// Creates a new background job that will wait for another background job to be triggered. /// </summary> /// <param name="client">A job client instance.</param> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="nextState">Next state for a job, when continuation is triggered. /// If null, then <see cref="EnqueuedState"/> is used.</param> /// <param name="options">Continuation options. By default, /// <see cref="JobContinuationOptions.OnlyOnSucceededState"/> is used.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [NotNull, InstantHandle] Expression <Func <T, Task> > methodCall, [CanBeNull] IState nextState = null, JobContinuationOptions options = JobContinuationOptions.OnlyOnSucceededState) { if (client == null) { throw new ArgumentNullException(nameof(client)); } var state = new AwaitingState(parentId, nextState ?? new EnqueuedState(), options); return(client.Create(Job.FromExpression(methodCall), state)); }
/// <summary> /// Creates a new background job that will wait for another background job to be triggered. /// </summary> /// <param name="client">A job client instance.</param> /// <param name="parentId">Identifier of a background job to wait completion for.</param> /// <param name="methodCall">Method call expression that will be marshalled to a server.</param> /// <param name="nextState">Next state for a job, when continuation is triggered.</param> /// <param name="options">Continuation options.</param> /// <returns>Unique identifier of a created job.</returns> public static string ContinueWith <T>( [NotNull] this IBackgroundJobClient client, [NotNull] string parentId, [NotNull, InstantHandle] Expression <Action <T> > methodCall, [NotNull] IState nextState, JobContinuationOptions options) { if (client == null) { throw new ArgumentNullException(nameof(client)); } var state = new AwaitingState(parentId, nextState, options); return(client.Create(Job.FromExpression(methodCall), state)); }
public AwaitingState( [NotNull] string parentId, [NotNull] IState nextState, JobContinuationOptions options, TimeSpan expiration) { if (parentId == null) { throw new ArgumentNullException(nameof(parentId)); } if (nextState == null) { throw new ArgumentNullException(nameof(nextState)); } ParentId = parentId; NextState = nextState; Options = options; Expiration = expiration; }
public static void SetSubAtomContinuation(this IStorageConnection connection, string subatomId, JobContinuationOptions continuationOptions) { var serializedOptions = continuationOptions.ToString("G"); connection.SetJobParameter(subatomId, Atom.ParameterSubatomContinuation, serializedOptions); }
public AwaitingState(string parentId, IState nextState, JobContinuationOptions options) : this(parentId, nextState, options, DefaultExpiration) { }
public BatchTask ContinueWith <T>(Expression <Action <T> > methodCall, JobContinuationOptions options = JobContinuationOptions.OnAnyFinishedState) { _parentJobId = BackgroundJob.ContinueJobWith <T>(_parentJobId, methodCall, options); return(this); }
public string SendNow(IRequest request, string parentJobId, JobContinuationOptions continuationOption, string description = null) { var mediatorSerializedObject = SerializeObject(request, description); return(BackgroundJob.ContinueJobWith(parentJobId, () => commandsExecutor.ExecuteCommand(mediatorSerializedObject), continuationOption)); }
public string Enqueue(MediatorSerializedObject mediatorSerializedObject, string parentJobId, JobContinuationOptions continuationOption, string description = null) { return(BackgroundJob.ContinueJobWith(parentJobId, () => _commandsExecutor.ExecuteCommand(mediatorSerializedObject), continuationOption)); }