/// <inheritdoc />
        public string Create(Job job, IState state)
        {
            if (job == null)
            {
                throw new ArgumentNullException("job");
            }
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            try
            {
                using (var connection = _storage.GetConnection())
                {
                    var context      = new CreateContext(connection, job, state);
                    var stateMachine = _stateMachineFactory.Create(connection);

                    return(_process.Run(context, stateMachine));
                }
            }
            catch (Exception ex)
            {
                throw new CreateJobFailedException("Job creation process has failed. See inner exception for details", ex);
            }
        }
Esempio n. 2
0
        /// <inheritdoc />
        public string Create(Job job, IState state)
        {
            if (job == null)
            {
                throw new ArgumentNullException("job");
            }
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            try
            {
                var context = new CreateContext(_connection, _stateMachineFactory, job, state);
                _process.Run(context);

                return(context.JobId);
            }
            catch (Exception ex)
            {
                throw new CreateJobFailedException("Job creation process has bee failed. See inner exception for details", ex);
            }
        }