Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Exchange Internals to Improve Developer Experience #1

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Jackrabbit

This is a fork of [hunterloftis/jackrabbit].

[![CircleCI](https://circleci.com/gh/pagerinc/jackrabbit.svg?style=svg)](https://circleci.com/gh/pagerinc/jackrabbit)
This is a fork of [pagerinc/jackrabbit], which is a fork of [hunterloftis/jackrabbit].

Jackrabbit is a very opinionated abstraction built on top of `amqplib` focused
on usability and implementing several messaging patterns on RabbitMQ.
Expand All @@ -13,7 +11,7 @@ on usability and implementing several messaging patterns on RabbitMQ.
// producer.js
'use strict';

const jackrabbit = require('@pager/jackrabbit');
const jackrabbit = require('tibbarkcaj');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
Expand All @@ -26,7 +24,7 @@ rabbit
// consumer.js
'use strict';

const jackrabbit = require('@pager/jackrabbit');
const jackrabbit = require('tibbarkcaj');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
Expand All @@ -44,7 +42,7 @@ function onMessage(data) {
```js
'use strict';

const jackrabbit = require('@pager/jackrabbit');
const jackrabbit = require('tibbarkcaj');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
Expand All @@ -61,13 +59,13 @@ rabbit

## More Examples

For now, the best usage help is can be found in [examples](https://github.com/pagerinc/jackrabbit/tree/master/examples),
For now, the best usage help is can be found in [examples](https://github.com/akamaozu/tibbarkcaj/tree/master/examples),
which map 1-to-1 with the official RabbitMQ tutorials.

## Installation

```
npm install --save @pager/jackrabbit
npm install --save tibbarkcaj
```

## Tests
Expand All @@ -80,6 +78,7 @@ to run them:
$ docker-compose up
```

[pagerinc/jackrabbit]: https://github.com/pagerinc/jackrabbit
[hunterloftis/jackrabbit]: https://github.com/hunterloftis/jackrabbit

## Reconnection
Expand Down
21 changes: 20 additions & 1 deletion lib/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,24 @@ const exchange = (name, type, exchangeOptions) => {
});
};

const getInternals = () => {

const internals = {
// amqplib instances
connection,
channel,

// internal state
ready,
blocked,
connecting,
publishing,
replyQueueConfigured,
}

return internals
}

const emitter = Extend(new EventEmitter(), {
name,
type,
Expand All @@ -441,7 +459,8 @@ const exchange = (name, type, exchangeOptions) => {
publishSafe,
getWritableStream,
rpcClient,
rpcServer
rpcServer,
getInternals,
});

return emitter;
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pager/jackrabbit",
"version": "5.4.4",
"name": "tibbarkcaj",
"version": "1.0.0",
"description": "Easy RabbitMQ for node",
"keywords": [
"amqp",
Expand All @@ -17,10 +17,10 @@
],
"repository": {
"type": "git",
"url": "git://github.com/pagerinc/jackrabbit.git"
"url": "git://github.com/akamaozu/tibbarkcaj.git"
},
"homepage": "https://github.com/pagerinc/jackrabbit",
"bugs": "https://github.com/pagerinc/jackrabbit/issues",
"homepage": "https://github.com/akamaozu/tibbarkcaj",
"bugs": "https://github.com/akamaozu/tibbarkcaj/issues",
"main": "lib/jackrabbit.js",
"renovate": {
"extends": [
Expand All @@ -34,7 +34,7 @@
"node": ">= v10.18.0"
},
"license": "MIT",
"author": "Pager Developers <engineering@pager.com>",
"author": "akamaozu <uzo@designbymobius.ca>",
"contributors": [
"Pager Developers <engineering@pager.com>",
"Hunter Loftis <hunter@hunterloftis.com>"
Expand Down