All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.datarouter.aws.sqs.SqsOpFactory Maven / Gradle / Ivy

There is a newer version: 0.0.125
Show newest version
/*
 * Copyright © 2009 HotPads ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.datarouter.aws.sqs;

import java.util.Collection;
import java.util.List;

import io.datarouter.aws.sqs.group.op.SqsGroupPeekMultiOp;
import io.datarouter.aws.sqs.group.op.SqsGroupPutMultiOp;
import io.datarouter.aws.sqs.op.SqsAckMultiOp;
import io.datarouter.aws.sqs.op.SqsAckOp;
import io.datarouter.aws.sqs.op.SqsOp;
import io.datarouter.aws.sqs.single.op.SqsPeekMultiOp;
import io.datarouter.aws.sqs.single.op.SqsPutMultiOp;
import io.datarouter.aws.sqs.single.op.SqsPutOp;
import io.datarouter.model.databean.Databean;
import io.datarouter.model.key.primary.PrimaryKey;
import io.datarouter.model.serialize.fielder.DatabeanFielder;
import io.datarouter.storage.client.ClientId;
import io.datarouter.storage.config.Config;
import io.datarouter.storage.queue.GroupQueueMessage;
import io.datarouter.storage.queue.QueueMessage;
import io.datarouter.storage.queue.QueueMessageKey;

public class SqsOpFactory,D extends Databean,F extends DatabeanFielder>{

	private final BaseSqsNode sqsNode;
	private final SqsClientManager sqsClientManager;
	private final ClientId clientId;

	public SqsOpFactory(BaseSqsNode sqsNode, SqsClientManager sqsClientManager, ClientId clientId){
		this.sqsNode = sqsNode;
		this.sqsClientManager = sqsClientManager;
		this.clientId = clientId;
	}

	public SqsOp>> makePeekMultiOp(Config config){
		return new SqsPeekMultiOp<>(config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp makeAckMultiOp(Collection keys, Config config){
		return new SqsAckMultiOp<>(keys, config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp makePutMultiOp(Collection databeans, Config config){
		return new SqsPutMultiOp<>(databeans, config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp makePutOp(D databean, Config config){
		return new SqsPutOp<>(databean, config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp makeAckOp(QueueMessageKey key, Config config){
		return new SqsAckOp<>(key, config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp makeGroupPutMultiOp(Collection databeans, Config config){
		return new SqsGroupPutMultiOp<>(databeans, config, sqsNode, sqsClientManager, clientId);
	}

	public SqsOp>> makeGroupPeekMultiOp(Config config){
		return new SqsGroupPeekMultiOp<>(config, sqsNode, sqsClientManager, clientId);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy