func newPayloadRequestHandler(
	ctx context.Context,
	taskEngine engine.TaskEngine,
	ecsClient api.ECSClient,
	cluster string,
	containerInstanceArn string,
	acsClient wsclient.ClientServer,
	saver statemanager.Saver,
	refreshHandler refreshCredentialsHandler,
	credentialsManager credentials.Manager,
	taskHandler *eventhandler.TaskHandler) payloadRequestHandler {
	// Create a cancelable context from the parent context
	derivedContext, cancel := context.WithCancel(ctx)
	return payloadRequestHandler{
		messageBuffer:        make(chan *ecsacs.PayloadMessage, payloadMessageBufferSize),
		ackRequest:           make(chan string, payloadMessageBufferSize),
		taskEngine:           taskEngine,
		ecsClient:            ecsClient,
		saver:                saver,
		taskHandler:          taskHandler,
		ctx:                  derivedContext,
		cancel:               cancel,
		cluster:              cluster,
		containerInstanceArn: containerInstanceArn,
		acsClient:            acsClient,
		refreshHandler:       refreshHandler,
		credentialsManager:   credentialsManager,
	}
}
func newPayloadRequestHandler(
	ctx context.Context,
	taskEngine engine.TaskEngine,
	ecsClient api.ECSClient,
	cluster string,
	containerInstanceArn string,
	acsClient wsclient.ClientServer,
	saver statemanager.Saver,
	refreshHandler refreshCredentialsHandler,
	credentialsManager credentials.Manager,
	taskHandler *eventhandler.TaskHandler) payloadRequestHandler {
	
	derivedContext, cancel := context.WithCancel(ctx)
	return payloadRequestHandler{
		messageBuffer:        make(chan *ecsacs.PayloadMessage, payloadMessageBufferSize),
		ackRequest:           make(chan string, payloadMessageBufferSize),
		taskEngine:           taskEngine,
		ecsClient:            ecsClient,
		saver:                saver,
		taskHandler:          taskHandler,
		ctx:                  derivedContext,
		cancel:               cancel,
		cluster:              cluster,
		containerInstanceArn: containerInstanceArn,
		acsClient:            acsClient,
		refreshHandler:       refreshHandler,
		credentialsManager:   credentialsManager,
	}
}
func newPayloadRequestHandler ( ctx context . Context , taskEngine engine . TaskEngine , ecsClient api . ECSClient , cluster string , containerInstanceArn string , acsClient wsclient . ClientServer , saver statemanager . Saver , refreshHandler refreshCredentialsHandler , credentialsManager credentials . Manager , taskHandler * eventhandler . TaskHandler ) payloadRequestHandler { // Create a cancelable context from the parent context derivedContext , cancel := context . WithCancel ( ctx ) return payloadRequestHandler { messageBuffer : make ( chan * ecsacs . PayloadMessage , payloadMessageBufferSize ) , ackRequest : make ( chan string , payloadMessageBufferSize ) , taskEngine : taskEngine , ecsClient : ecsClient , saver : saver , taskHandler : taskHandler , ctx : derivedContext , cancel : cancel , cluster : cluster , containerInstanceArn : containerInstanceArn , acsClient : acsClient , refreshHandler : refreshHandler , credentialsManager : credentialsManager , } }
// newPayloadRequestHandler returns a new payloadRequestHandler object
newPayloadRequestHandler returns a new payloadRequestHandler object