001/*
002 * (C) Copyright 2006-2018 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 *
017 * Contributors:
018 *     anechaev
019 */
020package org.nuxeo.runtime.kafka;
021
022import java.util.Properties;
023
024import org.nuxeo.common.xmap.annotation.XNode;
025import org.nuxeo.common.xmap.annotation.XNodeMap;
026import org.nuxeo.common.xmap.annotation.XObject;
027import org.nuxeo.runtime.model.Descriptor;
028
029@XObject("kafkaConfig")
030public class KafkaConfigDescriptor implements Descriptor {
031
032    @XObject("consumer")
033    public static class ConsumerProperties {
034        @XNodeMap(value = "property", key = "@name", type = Properties.class, componentType = String.class)
035        protected Properties properties = new Properties();
036    }
037
038    @XObject("producer")
039    public static class ProducerProperties {
040        @XNodeMap(value = "property", key = "@name", type = Properties.class, componentType = String.class)
041        protected Properties properties = new Properties();
042    }
043
044    @XNode("@name")
045    public String name;
046
047    @XNode("@zkServers")
048    public String zkServers;
049
050    @XNode("@topicPrefix")
051    public String topicPrefix;
052
053    @XNode("@randomPrefix")
054    public Boolean randomPrefix = Boolean.FALSE;
055
056    @XNode("producer")
057    public ProducerProperties producerProperties = new ProducerProperties();
058
059    @XNode("consumer")
060    public ConsumerProperties consumerProperties = new ConsumerProperties();
061
062    @Override
063    public String getId() {
064        return name;
065    }
066
067}