Skip to content

Commit

Permalink
Rename producer builder to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusjunges committed Feb 14, 2024
1 parent 9db312d commit f2905e8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/producing-messages/5-publishing-to-kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ After configuring all your message options, you must use the send method, to sen
```php
use Junges\Kafka\Facades\Kafka;

/** @var \Junges\Kafka\Producers\ProducerBuilder $producer */
/** @var \Junges\Kafka\Producers\Builder $producer */
$producer = Kafka::publishOn('topic')
->withConfigOptions(['key' => 'value'])
->withKafkaKey('kafka-key')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $messageBatch->push($message);
$messageBatch->push($message);
$messageBatch->push($message);

/** @var \Junges\Kafka\Producers\ProducerBuilder $producer */
/** @var \Junges\Kafka\Producers\Builder $producer */
$producer = Kafka::publishOn('topic')
->withConfigOptions(['key' => 'value']);

Expand Down
4 changes: 1 addition & 3 deletions src/Contracts/MessageProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use Junges\Kafka\Producers\Producer;
use Junges\Kafka\Support\Testing\Fakes\ProducerFake;

/**
* @internal
*/
/** @internal */
interface MessageProducer extends InteractsWithConfigCallbacks
{
/** Return a new Junges\Commit\ProducerBuilder instance. */
Expand Down
4 changes: 2 additions & 2 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Junges\Kafka\Consumers\ConsumerBuilder;
use Junges\Kafka\Contracts\KafkaManager;
use Junges\Kafka\Contracts\MessageProducer;
use Junges\Kafka\Producers\ProducerBuilder;
use Junges\Kafka\Producers\Builder;

class Factory implements KafkaManager
{
Expand All @@ -15,7 +15,7 @@ class Factory implements KafkaManager
/** Creates a new ProducerBuilder instance, setting brokers and topic. */
public function publish(string $broker = null): MessageProducer
{
return new ProducerBuilder(
return new Builder(
broker: $broker ?? config('kafka.brokers')
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Junges\Kafka\Contracts\MessageSerializer;
use Junges\Kafka\Contracts\ProducerMessage;

class ProducerBuilder implements MessageProducer
class Builder implements MessageProducer
{
use InteractsWithConfigCallbacks;
use Conditionable;
Expand Down Expand Up @@ -38,7 +38,7 @@ public function __construct(
/** Return a new Junges\Commit\ProducerBuilder instance. */
public static function create(string $broker = null): self
{
return new ProducerBuilder(
return new Builder(
broker: $broker ?? config('kafka.brokers')
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/KafkaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Junges\Kafka\Message\Message;
use Junges\Kafka\Message\Serializers\JsonSerializer;
use Junges\Kafka\Producers\MessageBatch;
use Junges\Kafka\Producers\ProducerBuilder;
use Junges\Kafka\Producers\Builder;
use Mockery as m;
use RdKafka\Producer;
use RdKafka\ProducerTopic;
Expand Down Expand Up @@ -193,7 +193,7 @@ public function testICanDisableDebugUsingWithDebugDisabledMethod(): void
return $mockedProducer;
});

/** @var ProducerBuilder $producer */
/** @var Builder $producer */
$producer = Kafka::publish()
->withConfigOptions([
'metadata.broker.list' => 'broker',
Expand Down Expand Up @@ -343,7 +343,7 @@ public function testMacro(): void

$producer = Kafka::defaultProducer();

$this->assertInstanceOf(ProducerBuilder::class, $producer);
$this->assertInstanceOf(Builder::class, $producer);
$this->assertEquals($sasl, $this->getPropertyWithReflection('saslConfig', $producer));
}
}

0 comments on commit f2905e8

Please sign in to comment.