io.openmessaging.Producer Java Examples

The following examples show how to use io.openmessaging.Producer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: V7ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() { 
            //init producer
            try {
                Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
                KeyValue keyValue = (KeyValue) kvClass.newInstance();
                keyValue.put("STORE_PATH", Constants.STORE_PATH);
                Class producerClass = Class.forName("io.openmessaging.v7.V7Producer");
                producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
                if (producer == null) {
                    throw new InstantiationException("Init Producer Failed");
                }
            } catch (Exception e) {
                logger.error("please check the package name and class name:", e);
            }
            //init offsets,topic0-9,queue0-9
            for (int i = 0; i < 10; i++) {
//                offsets.put("TOPIC_" + i, 0);
                offsets.put("QUEUE_" + i, 0);
            }
            for (int i = 0; i < 100; i++) {
                offsets.put("TOPIC_" + i, 0);
            }

        }
 
Example #2
Source File: V1ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.v1.V1Producer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets,topic0-9,queue0-9
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #3
Source File: ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
            //init producer
            try {
                Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
                KeyValue keyValue = (KeyValue) kvClass.newInstance();
                keyValue.put("STORE_PATH", Constants.STORE_PATH);
                Class producerClass = Class.forName("io.openmessaging.demo.DefaultProducer");
                producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
                if (producer == null) {
                    throw new InstantiationException("Init Producer Failed");
                }
            } catch (Exception e) {
                logger.error("please check the package name and class name:", e);
            }
            //init offsets,topic0-9,queue0-9
            for (int i = 0; i < 10; i++) {
//                offsets.put("TOPIC_" + i, 0);
                offsets.put("QUEUE_" + i, 0);
            }
            for (int i = 0; i < 100; i++) {
                offsets.put("TOPIC_" + i, 0);
            }

        }
 
Example #4
Source File: V6ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() { 
            //init producer
            try {
                Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
                KeyValue keyValue = (KeyValue) kvClass.newInstance();
                keyValue.put("STORE_PATH", Constants.STORE_PATH);
                Class producerClass = Class.forName("io.openmessaging.v6.V6Producer");
                producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
                if (producer == null) {
                    throw new InstantiationException("Init Producer Failed");
                }
            } catch (Exception e) {
                logger.error("please check the package name and class name:", e);
            }
            //init offsets,topic0-9,queue0-9
            for (int i = 0; i < 10; i++) {
//                offsets.put("TOPIC_" + i, 0);
                offsets.put("QUEUE_" + i, 0);
            }
            for (int i = 0; i < 100; i++) {
                offsets.put("TOPIC_" + i, 0);
            }

        }
 
Example #5
Source File: V4ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.v4.V4Producer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets,topic0-9,queue0-9
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #6
Source File: V2ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.v2.V2Producer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets,topic0-9,queue0-9
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #7
Source File: V5ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
            //init producer
            try {
                Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
                KeyValue keyValue = (KeyValue) kvClass.newInstance();
                keyValue.put("STORE_PATH", Constants.STORE_PATH);
                Class producerClass = Class.forName("io.openmessaging.v5.V5Producer");
                producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
                if (producer == null) {
                    throw new InstantiationException("Init Producer Failed");
                }
            } catch (Exception e) {
                logger.error("please check the package name and class name:", e);
            }
            //init offsets,topic0-9,queue0-9,修改topic为0-99
            for (int i = 0; i < 10; i++) {
//                offsets.put("TOPIC_" + i, 0);
                offsets.put("QUEUE_" + i, 0);
            }
            for (int i = 0; i < 100; i++) {
              offsets.put("TOPIC_" + i, 0);
//              offsets.put("QUEUE_" + i, 0);
          }

        }
 
Example #8
Source File: V3ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init(){
    try {
        Class kvClass=Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue= (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass=Class.forName("io.openmessaging.v3.V3Producer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer==null){
            throw new InstantiationException("Init Producer Fail");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets,topic0-9,queue0-9
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }
}
 
Example #9
Source File: ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.demo.DefaultProducer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #10
Source File: ProducerTester.java    From coding-snippets with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.demo.DefaultProducer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets
    for (int i = 0; i < NUM_TOPIC_QUEUE; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #11
Source File: ProducerTester.java    From OpenMessageShaping with MIT License 6 votes vote down vote up
public void init() {
    //init producer
    try {
        Class kvClass = Class.forName("io.openmessaging.demo.DefaultKeyValue");
        KeyValue keyValue = (KeyValue) kvClass.newInstance();
        keyValue.put("STORE_PATH", Constants.STORE_PATH);
        Class producerClass = Class.forName("io.openmessaging.demo.DefaultProducer");
        producer = (Producer) producerClass.getConstructor(new Class[]{KeyValue.class}).newInstance(new Object[]{keyValue});
        if (producer == null) {
            throw new InstantiationException("Init Producer Failed");
        }
    } catch (Exception e) {
        logger.error("please check the package name and class name:", e);
    }
    //init offsets
    for (int i = 0; i < 10; i++) {
        offsets.put("TOPIC_" + i, 0);
        offsets.put("QUEUE_" + i, 0);
    }

}
 
Example #12
Source File: MessagingAccessPointImpl.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer(KeyValue properties) {
    return new ProducerImpl(OMSUtil.buildKeyValue(this.accessPointProperties, properties));
}
 
Example #13
Source File: MessagingAccessPointImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer() {
    return new ProducerImpl(this.accessPointProperties);
}
 
Example #14
Source File: MessagingAccessPointImpl.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer() {
    return new ProducerImpl(this.accessPointProperties);
}
 
Example #15
Source File: MessagingAccessPointImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer(KeyValue properties) {
    return new ProducerImpl(OMSUtil.buildKeyValue(this.accessPointProperties, properties));
}
 
Example #16
Source File: MessagingAccessPointImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer() {
    return new ProducerImpl(this.accessPointProperties);
}
 
Example #17
Source File: MessagingAccessPointImpl.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public Producer createProducer(KeyValue properties) {
    return new ProducerImpl(OMSUtil.buildKeyValue(this.accessPointProperties, properties));
}