def publishMsg(event, _context): config = Config.from_env() config.log() log_event(event) update_data_delivery_state(event, "in_nifi_bucket") if config.project_id is None: print("project_id not set, publish failed") return try: message = create_message(event, config) print(f"Message {message}") send_pub_sub_message(config, message) update_data_delivery_state(event, "nifi_notified") except Exception as error: print(repr(error)) update_data_delivery_state(event, "errored", repr(error))
def test_config_from_env(): config = Config.from_env() assert config.on_prem_subfolder == "DEV" assert config.project_id == "test_project_id" assert config.topic_name == "nifi-notify" assert config.env == "test"