Comments (5)
Would awesome. Had to kill some brain cells trying to dig out how to simply do this (which in reality in not directly related to Broadway :)):
def broadcast(queue_name, event_type, message_struct) do
struct = %{event_type: event_type, body: message_struct}
IO.puts("Broadcasting '#{event_type}' to queue '#{queue_name}'.")
# TODO: Eventually store the broadcasted message in the database as
# an history/log entry (or send to datadog)
ExAws.SQS.send_message(
queue_name,
Poison.encode!(struct)
)
|> ExAws.request(%{
secret_access_key: System.get_env("AWS_SECRET_ACCESS_KEY"),
access_key_id: System.get_env("AWS_ACCESS_KEY_ID"),
region: System.get_env("AWS_REGION"),
host: "sqs.eu-west-1.amazonaws.com",
scheme: "https"
})
end
Would be great to be able to post a message to a queue reusing the credentials i already define for Broadway. If there is, please let me know how :)
And while i'm here, is there a way to fake the producer for testing purposes? Would love to test my worker without having to have AWS queues setup or having to install RabbitMQ :(
from broadway.
You can share credentials by simply moving the code to a function and calling that function from both! For a faker, you can use Mox or similar.
from broadway.
You'll also be able to use a DummyProducer
in your tests after #91 is merged.
from broadway.
Cool, thank you guys!
from broadway.
I was trying to create a fake producer as well, but couldn't figure out the @behaviour thing. Total noob in Elixir here. Thanks again! :)
from broadway.
Related Issues (20)
- Pipeline design HOT 2
- Support hot-reloads to scale stages HOT 2
- 1->n message processing HOT 3
- Possibility to update Pipeline :context ? HOT 1
- Allow use of nimble_options 0.4.0 HOT 2
- [Question] how am i able to update a message in handle_failed and send to another batcher? HOT 1
- How to stop a Broadway Kafka pipeline? HOT 1
- Make producer module a keyword list to ease configuration management? HOT 6
- Broadway.update_rate_limit doesn't reset the counter/interval right away HOT 3
- NoopAcknowledger fails with ack key being set HOT 7
- Disable automatic call to handle_batch/4 HOT 2
- [Question] Creating a Broadway Message struct for testing?
- Telemetry distinguish between Producer metrics HOT 2
- Expected Behavior on Startup? HOT 4
- [docs] The `Broadway.test_batch` example doesn't work with Broadway 1.0.3 HOT 3
- Dialyzer error on ack_immediately/1 HOT 3
- Broadway v1.0.4 Broadway.NoopAcknowledger returns NoopAcknowledger instead of Broadway.NoopAcknowledger HOT 1
- Add `terminate/3` callback HOT 11
- Oban producer HOT 3
- Allow support for Nimble Options 1.0 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from broadway.