-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding rabbit publish handler * feat: handling model name * feat: adding converter for payloads * feat:rabbit-publisher add unit tests and handlers * feat:rabbit-publisher fixing imports * feat:rabbit-publisher add more unit tests * feat:rabbit-publisher cleaning up code * feat:rabbit-publisher cleaning up payload * feat:rabbit-publisher adding publisher code * feat:rabbit-publisher fixing lint checks * feat:rabbit-publisher fixing tests * feat: rabbi-publisher cleanup code * feat: rabbit-publisher adding husky * feat: addressing issues in PR * feat: addressing code review comments * feat: addressing code review comments * feat: formatting changes * feat: contribution guide * feat: corrections to readme * feat: formatting read me * feat: add guard for missing operationId
- Loading branch information
1 parent
a22e085
commit 7d9587d
Showing
21 changed files
with
1,074 additions
and
15,576 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run lint | ||
npm test |
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
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 @@ | ||
//render an AMQP subscriber | ||
function AMQPPublisher() { | ||
return ` | ||
// GetAMQPPublisher returns an amqp publisher based on the URI | ||
func GetAMQPPublisher(amqpURI string) (*amqp.Publisher, error) { | ||
amqpConfig := amqp.NewDurableQueueConfig(amqpURI) | ||
return amqp.NewPublisher( | ||
amqpConfig, | ||
watermill.NewStdLogger(false, false), | ||
) | ||
} | ||
`; | ||
} | ||
|
||
export function Publisher({publisherFlags}) { | ||
const amqpMod = 'github.com/ThreeDotsLabs/watermill-amqp/pkg/amqp'; | ||
|
||
const modules = []; | ||
const publishers = []; | ||
let importMod = ''; | ||
let publisherBlock = ''; | ||
if (publisherFlags.hasAMQPPub) { | ||
modules.push(amqpMod); | ||
publishers.push(AMQPPublisher()); | ||
} | ||
|
||
if (modules.length > 0) { | ||
importMod = modules.map(m => `"${m}"`).join('\n'); | ||
} | ||
|
||
if (publishers.length > 0) { | ||
publisherBlock = publishers.join('\n'); | ||
} | ||
|
||
return ` | ||
package asyncapi | ||
import ( | ||
"github.com/ThreeDotsLabs/watermill" | ||
${importMod} | ||
) | ||
${publisherBlock} | ||
`; | ||
} |
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
Oops, something went wrong.