Search in sources :

Example 6 with ByteArraySerializer

use of org.apache.kafka.common.serialization.ByteArraySerializer in project kafka by apache.

the class KafkaProducerTest method testConstructorWithSerializers.

@Test
public void testConstructorWithSerializers() {
    Properties producerProps = new Properties();
    producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9000");
    new KafkaProducer<>(producerProps, new ByteArraySerializer(), new ByteArraySerializer()).close();
}
Also used : Properties(java.util.Properties) ByteArraySerializer(org.apache.kafka.common.serialization.ByteArraySerializer) Test(org.junit.Test) PrepareOnlyThisForTest(org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)

Example 7 with ByteArraySerializer

use of org.apache.kafka.common.serialization.ByteArraySerializer in project samza by apache.

the class StandaloneIntegrationTestHarness method setUp.

@Override
public void setUp() {
    super.setUp();
    producer = TestUtils.createNewProducer(bootstrapServers(), 1, 60 * 1000L, 1024L * 1024L, 0, 0L, 5 * 1000L, SecurityProtocol.PLAINTEXT, null, Option$.MODULE$.<Properties>apply(new Properties()), new StringSerializer(), new ByteArraySerializer(), Option$.MODULE$.<Properties>apply(new Properties()));
    consumer = TestUtils.createNewConsumer(bootstrapServers(), "group", "earliest", 4096L, "org.apache.kafka.clients.consumer.RangeAssignor", 30000, SecurityProtocol.PLAINTEXT, Option$.MODULE$.<File>empty(), Option$.MODULE$.<Properties>empty(), Option$.MODULE$.<Properties>empty());
}
Also used : Properties(java.util.Properties) StringSerializer(org.apache.kafka.common.serialization.StringSerializer) ByteArraySerializer(org.apache.kafka.common.serialization.ByteArraySerializer) File(java.io.File)

Aggregations

ByteArraySerializer (org.apache.kafka.common.serialization.ByteArraySerializer)7 Test (org.junit.Test)5 PrepareOnlyThisForTest (org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)5 Properties (java.util.Properties)4 HashMap (java.util.HashMap)3 File (java.io.File)1 KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer)1 ProducerRecord (org.apache.kafka.clients.producer.ProducerRecord)1 RecordMetadata (org.apache.kafka.clients.producer.RecordMetadata)1 KafkaException (org.apache.kafka.common.KafkaException)1 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)1 MockMetricsReporter (org.apache.kafka.test.MockMetricsReporter)1