Skip to content

Commit

Permalink
fix: pubsub emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
joacohoyos committed Aug 23, 2024
1 parent 02b477a commit 34ff1e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sinks/gcp_pubsub/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ pub fn writer_loop(
retry_policy: &retry::Policy,
ordering_key: &str,
attributes: &GenericKV,
emulator: bool,
emulator_endpoint: &Option<String>,
emulator_project_id: &Option<String>,
utils: Arc<Utils>,
) -> Result<(), crate::Error> {
let rt = tokio::runtime::Builder::new_current_thread()
Expand Down
9 changes: 9 additions & 0 deletions src/sinks/gcp_pubsub/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ pub struct Config {
impl SinkProvider for WithUtils<Config> {
fn bootstrap(&self, input: StageReceiver) -> BootstrapResult {
let topic_name = self.inner.topic.to_owned();
let mut use_emulator = self.inner.emulator.unwrap_or(false);
let emulator_endpoint = self.inner.emulator_endpoint.to_owned();
let emulator_project_id = self.inner.emulator_project_id.to_owned();
if use_emulator && (emulator_endpoint.is_none() || emulator_project_id.is_none()) {
use_emulator = false;
}

let error_policy = self
.inner
Expand All @@ -50,6 +56,9 @@ impl SinkProvider for WithUtils<Config> {
&retry_policy,
&ordering_key,
&attributes,
use_emulator,
&emulator_endpoint,
&emulator_project_id,
utils,
)
.expect("writer loop failed");
Expand Down

0 comments on commit 34ff1e3

Please sign in to comment.