Skip to content

Commit

Permalink
Merge pull request #1 from Akamaozu/expose-exchange-channel
Browse files Browse the repository at this point in the history
Expose Exchange Internals to Improve Developer Experience
  • Loading branch information
Akamaozu authored Nov 28, 2023
2 parents 7fb2afc + aefba56 commit fa89007
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
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

0 comments on commit fa89007

Please sign in to comment.