/*
* Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Amazon Software License (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/asl/
*
* or in the "license" file accompanying this file. This file 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 samples.elasticsearch;
import samples.KinesisMessageModel;
import com.amazonaws.services.kinesis.connectors.KinesisConnectorConfiguration;
import com.amazonaws.services.kinesis.connectors.elasticsearch.ElasticsearchEmitter;
import com.amazonaws.services.kinesis.connectors.elasticsearch.ElasticsearchObject;
import com.amazonaws.services.kinesis.connectors.impl.AllPassFilter;
import com.amazonaws.services.kinesis.connectors.impl.BasicMemoryBuffer;
import com.amazonaws.services.kinesis.connectors.interfaces.IBuffer;
import com.amazonaws.services.kinesis.connectors.interfaces.IEmitter;
import com.amazonaws.services.kinesis.connectors.interfaces.IFilter;
import com.amazonaws.services.kinesis.connectors.interfaces.IKinesisConnectorPipeline;
import com.amazonaws.services.kinesis.connectors.interfaces.ITransformerBase;
public class ElasticsearchPipeline implements IKinesisConnectorPipeline<KinesisMessageModel, ElasticsearchObject> {
@Override
public IEmitter<ElasticsearchObject> getEmitter(KinesisConnectorConfiguration configuration) {
return new ElasticsearchEmitter(configuration);
}
@Override
public IBuffer<KinesisMessageModel> getBuffer(KinesisConnectorConfiguration configuration) {
return new BasicMemoryBuffer<KinesisMessageModel>(configuration);
}
@Override
public ITransformerBase<KinesisMessageModel, ElasticsearchObject>
getTransformer(KinesisConnectorConfiguration configuration) {
if (configuration.BATCH_RECORDS_IN_PUT_REQUEST) {
return new BatchedKinesisMessageModelElasticsearchTransformer();
} else {
return new SingleKinesisMessageModelElasticsearchTransformer();
}
}
@Override
public IFilter<KinesisMessageModel> getFilter(KinesisConnectorConfiguration configuration) {
return new AllPassFilter<KinesisMessageModel>();
}
}