Пример #1
0
// SendChain triggers a chain of tasks
func (server *Server) SendChain(chain *Chain) (*backends.ChainAsyncResult, error) {
	_, err := server.SendTask(chain.Tasks[0])
	if err != nil {
		return nil, err
	}

	return backends.NewChainAsyncResult(chain.Tasks, server.backend), nil
}
Пример #2
0
// SendChain triggers a chain of tasks
func (server *Server) SendChain(chain *Chain) (*backends.ChainAsyncResult, error) {
	if err := server.broker.Publish(chain.Tasks[0]); err != nil {
		return nil, fmt.Errorf("Publish Message: %v", err)
	}

	// Update task state to PENDING
	if err := server.backend.SetStatePending(chain.Tasks[0]); err != nil {
		return nil, fmt.Errorf("Set State Pending: %v", err)
	}

	return backends.NewChainAsyncResult(chain.Tasks, server.backend), nil
}