Skip to content

Commit

Permalink
Adds fresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusjunges committed Aug 18, 2024
1 parent 0864373 commit c75463f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Contracts/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

interface Manager
{
/** Returns a new fresh instance of the Manager. */
public function fresh(): self;

/** Creates a new ProducerBuilder instance, setting brokers and topic. */
public function publish(?string $broker = null): MessageProducer;

Expand Down
1 change: 1 addition & 0 deletions src/Facades/Kafka.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/**
* @method static \Junges\Kafka\Contracts\MessageProducer publish(string $broker = null)
* @method static \Junges\Kafka\Contracts\MessageProducer asyncPublish(string $broker = null)
* @method static \Junges\Kafka\Factory fresh(string $broker = null)
* @method static \Junges\Kafka\Consumers\Builder consumer(array $topics = [], string $groupId = null, string $brokers = null)
* @method static void assertPublished(ProducerMessage $expectedMessage = null, callable $callback = null)
* @method static void assertPublishedTimes(int $times = 1, ProducerMessage $expectedMessage = null, callable $callback = null)
Expand Down
6 changes: 6 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public function publish(string $broker = null): MessageProducer
);
}

/** Returns a fresh factory instance. */
public function fresh(): self
{
return new self;
}

/**
* Creates a new ProducerBuilder instance, optionally setting the brokers.
* The producer will be flushed only when the application terminates,
Expand Down

0 comments on commit c75463f

Please sign in to comment.