-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Nats | ||
https://nats.io/ | ||
|
||
Nats JS(jetstream) | ||
https://docs.nats.io/nats-concepts/jetstream | ||
https://docs.nats.io/using-nats/developer/develop_jetstream | ||
https://docs.nats.io/nats-concepts/core-nats/queue#stream-as-a-queue | ||
|
||
JetStream wire API Reference | ||
https://docs.nats.io/reference/reference-protocols/nats_api_reference | ||
|
||
Shemas | ||
https://github.com/nats-io/jsm.go/tree/main/schema_source/jetstream/api/v1 | ||
|
||
JetStream Model Deep Dive | ||
https://docs.nats.io/using-nats/developer/develop_jetstream/model_deep_dive | ||
|
||
Pedantic mode | ||
https://docs.nats.io/using-nats/developer/connecting/misc#turn-on-pedantic-mode | ||
|
||
Using NATS streaming for event sourcing with snapshots | ||
https://groups.google.com/g/natsio/c/OetiXggcFHk | ||
|
||
Go JetStream Simplified Client | ||
https://github.com/nats-io/nats.go/tree/main/jetstream#jetstream-simplified-client | ||
|
||
Nats JS client for php | ||
https://github.com/basis-company/nats.php | ||
|
||
Description of usage | ||
https://github.com/basis-company/nats.php/issues/59#issuecomment-1907919039 | ||
|
||
Ephemeral Consumer life cycle | ||
https://natsio.slack.com/archives/CM3T6T7JQ/p1711275996676309 | ||
https://natsio.slack.com/archives/CM3T6T7JQ/p1711278584957209?thread_ts=1711275996.676309&cid=CM3T6T7JQ | ||
|
||
Nats streaming as task queue | ||
https://github.com/nats-io/stan.js/issues/49 | ||
|
||
Nats articles | ||
https://www.byronruth.com/tag/series/ | ||
|
||
NATS and Docker | ||
https://docs.nats.io/running-a-nats-service/nats_docker | ||
|
||
RoadRunner Jobs | ||
https://docs.roadrunner.dev/queues-and-jobs/overview-queues | ||
|
||
Nats Jobs | ||
https://docs.roadrunner.dev/queues-and-jobs/nats | ||
https://github.com/roadrunner-server/nats/tree/master/natsjobs | ||
|
||
Beanstalk Jobs | ||
https://docs.roadrunner.dev/queues-and-jobs/beanstalk | ||
|
||
Allowed number of consumers for JS as Queue (WorkQueuePolicy) | ||
https://natsio.slack.com/archives/CM3T6T7JQ/p1712153925255479 | ||
|
||
JetStream Java tutorial | ||
https://nats.io/blog/hello-world-java-client/ | ||
|
||
JetStream stream creation in Java | ||
https://nats.io/blog/jetstream-java-client-01-stream-create/ | ||
|
||
JetStream publishing in Java | ||
https://nats.io/blog/jetstream-java-client-02-publish/ | ||
|
||
Consumers in Java | ||
https://nats.io/blog/jetstream-java-client-03-consume/ | ||
|
||
Push consumers in Java | ||
https://nats.io/blog/jetstream-java-client-04-push-subscribe/#jetstream-push-consumers-with-the-natsio-java-library | ||
|
||
Pull consumers in Java | ||
https://nats.io/blog/jetstream-java-client-05-pull-subscribe/#jetstream-pull-consumers-with-the-natsio-java-library |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Yiisoft\Queue\Nats\Exception; | ||
|
||
use Yiisoft\FriendlyException\FriendlyExceptionInterface; | ||
|
||
class DelayNotImplementedNatsException extends \RuntimeException implements FriendlyExceptionInterface | ||
{ | ||
public function getName(): string | ||
{ | ||
return 'Delay not implemented'; | ||
} | ||
|
||
public function getSolution(): ?string | ||
{ | ||
return 'Use 0 as delay value'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Queue\Nats\Exception; | ||
|
||
use Yiisoft\FriendlyException\FriendlyExceptionInterface; | ||
|
||
class NotConnectedNatsException extends \RuntimeException implements FriendlyExceptionInterface | ||
{ | ||
public function getName(): string | ||
{ | ||
return 'Not connected to Nats.'; | ||
} | ||
|
||
public function getSolution(): ?string | ||
{ | ||
return 'Check your Nats configuration and run nats->connect() before using it.'; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Yiisoft\Queue\Nats\Message; | ||
|
||
use Yiisoft\Queue\Message\MessageInterface; | ||
use Yiisoft\Queue\Nats\Exception\DelayNotImplementedNatsException; | ||
|
||
class Message implements MessageInterface | ||
{ | ||
public function __construct( | ||
private string $handlerName, | ||
private mixed $data, | ||
private array $metadata, | ||
private int $delay = 0 //delay in seconds | ||
) { | ||
if (0 != $delay) { | ||
throw new DelayNotImplementedNatsException(); | ||
} | ||
} | ||
|
||
public function withDelay(int $delay): self | ||
{ | ||
if (0 != $delay) { | ||
throw new DelayNotImplementedNatsException(); | ||
} | ||
|
||
$message = clone $this; | ||
|
||
return $message; | ||
} | ||
|
||
public function getHandlerName(): string | ||
{ | ||
return $this->handlerName; | ||
} | ||
|
||
public function getData(): mixed | ||
{ | ||
return $this->data; | ||
} | ||
|
||
public function getMetadata(): array | ||
{ | ||
return $this->metadata; | ||
} | ||
} |