Nachrichten von Ihrem Mainframe in Pub/Sub veröffentlichen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mit dem Mainframe Connector können Sie Nachrichten von Ihrem Mainframe an Pub/Sub veröffentlichen. Sie können diese Funktion beispielsweise verwenden, um Ihren Mainframe in BigQuery oder Cloud Storage einzubinden, Nachrichtendaten mit Dataflow zu ergänzen oder Cloud Run-Funktionen auszulösen.
Damit Sie Pub/Sub-Befehle ausführen können, müssen Sie Ihrem Nutzerkonto die Rolle Pub/Sub-Publisher zuweisen. Informationen zum Zuweisen von Rollen zu einem Nutzerkonto finden Sie unter Zugriff mit IAM verwalten.
Ersetzen Sie TOPIC durch den Namen des Pub/Sub-Themas. Das erforderliche Format ist projects/{project}/topics/{topic}.
Nachrichten in einem Pub/Sub-Thema veröffentlichen
Mit dem Mainframe-Connector können Sie strukturierte Nachrichten von einem Mainframe in einem Pub/Sub-Thema veröffentlichen. Mit dieser Funktion können Sie beispielsweise QSAM-Datensätze (Queued Sequential Access Method) mithilfe von Pub/Sub von Ihrem Mainframe in BigQuery übertragen. Dieser Ansatz bietet folgende Vorteile:
Sie können Daten mithilfe von KI über Dataflow oder Pub/Sub-Simultan-Multithreading (SMTs) transformieren oder ergänzen.
Sie können Datensätze von einem Mainframe in Cloud Storage verschieben.
Sie können Mainframe-Anwendungsupdates ähnlich wie bei der Datenerfassung (Change Data Capture, CDC) mit cloudbasierten Systemen synchronisieren.
So veröffentlichen Sie strukturierte Nachrichten von Ihrem Mainframe in einem Pub/Sub-Thema:
Erstelle ein Pub/Sub-Thema, um Informationen zu Datensätzen zu erfassen, die nicht transkodiert werden können. Dieses Thema wird als Spillover-Thema bezeichnet. Informationen zum Erstellen eines Pub/Sub-Themas finden Sie unter Thema erstellen.
Optional: Wenn Sie die Einträge vor dem Senden an Pub/Sub in JSON konvertieren möchten, konfigurieren Sie die JSON-Konfigurationsdatei.
Wenn Sie keine Konfigurationsdatei angeben, wird die Standard-JSON-Konfiguration verwendet.
Optional: Standardmäßig enthalten Pub/Sub-Nachrichten keine Sortierungsschlüssel und Attribute. Nachrichten, die nicht an das Hauptthema gesendet werden können, werden an das Thema mit dem Suffix _spillover gesendet. Wenn Sie die Standardeinstellungen ändern möchten, können Sie die Pub/Sub-Konfigurationsdatei für die Veröffentlichung konfigurieren. Sie können beispielsweise die folgende Konfiguration verwenden:
Ersetzen Sie SPILLOVER_TOPIC_NAME durch den Namen des Themenbereichs, den Sie in Schritt 2 erstellt haben. Das erforderliche Format ist projects/{project}/topics/{topic}. Informationen zu Nachrichten, die nicht richtig decodiert werden, werden in diesem Überlaufthema gespeichert.
Wenn Sie Mainframe-Einträge mit dem Befehl qsam decode in Pub/Sub veröffentlichen möchten, führen Sie die folgende JCL aus:
OUTPUT: der Datenpfad des Pub/Sub-Themas, das Sie in Schritt 1 erstellt haben. Das erforderliche Format ist pubsub:projects/{project}/topics/{topic}.
TRANSCODE-CONFIG: der Datenpfad der Datei mit der Transcodierungskonfiguration. Weitere Informationen zum Transcoder-Konfigurationsformat findest du unter Transcoder-Konfiguration.
JSON_CONFIGURATION: (optional) der Datenpfad der JSON-Konfigurationsdatei. Wenn Sie keine Konfigurationsdatei angeben, wird die Standard-JSON-Konfiguration verwendet.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (UTC)."],[],[],null,["# Publish messages to Pub/Sub from your mainframe\n\nMainframe Connector lets you publish messages to Pub/Sub\nfrom your mainframe. You can use this feature, for example, to integrate your\nmainframe with BigQuery or Cloud Storage, augment message data with\nDataflow, or trigger Cloud Run functions.\n\nBefore you begin\n----------------\n\n- If you haven't already, then [install Mainframe Connector on your mainframe](/mainframe-connector/docs/installation).\n- To run Pub/Sub commands, verify that you assign the [Pub/Sub Publisher](/iam/docs/roles-permissions/pubsub#pubsub.publisher) role to your user account. For information about assigning roles to a user account, see [Managing access using IAM](/run/docs/securing/managing-access).\n- Set up [Application Default Credentials](/docs/authentication/provide-credentials-adc).\n\nPublish a message to a Pub/Sub topic\n------------------------------------\n\nTo publish an unstructured Pub/Sub message from your mainframe,\nuse the [`pubsub topics publish` command](/mainframe-connector/docs/api-command-reference#pubsub_topics_publish) as follows: \n\n```\n//STEP01 EXEC BQSH\n//STDIN DD *\npubsub topics publish TOPIC --data=\"Hello,World\"\n/*\n```\n\nReplace \u003cvar translate=\"no\"\u003eTOPIC\u003c/var\u003e with the name of the Pub/Sub\ntopic. The required format is `projects/{project}/topics/{topic}`.\n\nPublish messages to a Pub/Sub topic\n-----------------------------------\n\nMainframe Connector lets you publish structured messages from a\nmainframe to a Pub/Sub topic. For example, you can use this\ncapability to transfer Queued Sequential Access Method (QSAM) records from your\nmainframe to BigQuery using Pub/Sub. The following are\nsome of the advantages of using this approach:\n\n- You can transform data or augment data with AI through Dataflow or through Pub/Sub simultaneous multithreading (SMTs).\n- You can move records from a mainframe to Cloud Storage.\n- You can synchronize mainframe application updates to cloud-based systems similar to change data capture (CDC).\n\nTo publish structured messages from your mainframe to a Pub/Sub\ntopic, use the following steps:\n\n1. Create a Pub/Sub topic to publish messages. Optionally, you can create a topic with a schema for more restrictions. For more information, see [Create a topic](/pubsub/docs/create-topic) or [Create and associate a schema when you create a topic](/pubsub/docs/associate-schema-topic).\n2. Create a Pub/Sub topic to capture information about records that fail to be transcoded. This topic is called a spillover topic. For information on creating a Pub/Sub topic, see [Create a topic](/pubsub/docs/create-topic).\n3. (Optional) To convert the records to JSON before sending them to Pub/Sub, configure the [JSON configuration file](/mainframe-connector/docs/json-configuration). If you don't provide a configuration file, the default JSON configuration is used.\n4. (Optional) By default, Pub/Sub messages don't contain ordering\n keys, and attributes. Spillover messages are sent to the spillover topic\n with the `_spillover` suffix. To change the defaults, you can\n configure the [Pub/Sub publish configuration file](/mainframe-connector/docs/pubsub-publish-configuration). For example, you can use the following configuration:\n\n ```\n {\n \"spillover-configuration\": {\n \"name\": SPILLOVER_TOPIC_NAME\n }\n }\n ```\n\n Replace \u003cvar translate=\"no\"\u003eSPILLOVER_TOPIC_NAME\u003c/var\u003e with the name of the\n spillover topic you created in step 2. The required format is\n `projects/{project}/topics/{topic}`. Information about messages\n that are not decoded properly is saved to this spillover topic.\n5. To publish mainframe records to Pub/Sub using the\n [`qsam decode` command](/mainframe-connector/docs/api-command-reference#qsam_decode),\n run the following JCL:\n\n //STEP01 EXEC BQSH\n //STDIN DD *\n qsam decode \u003cvar translate=\"no\"\u003eINPUT\u003c/var\u003e \u003cvar translate=\"no\"\u003eOUTPUT\u003c/var\u003e \\\n --copybook \u003cvar translate=\"no\"\u003eCOPYBOOK\u003c/var\u003e\n --transcode-configuration \u003cvar translate=\"no\"\u003eTRANSCODE-CONFIG\u003c/var\u003e\n --output-format=JSONL\n --input-parameter=json-dialect=\u003cvar translate=\"no\"\u003eJSON_CONFIGURATION\u003c/var\u003e\n --input-parameter=pubsub-publish-configuration=\u003cvar translate=\"no\"\u003ePUBSUB_CONFIGURATION\u003c/var\u003e\n /*\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINPUT\u003c/var\u003e: the [data path](/mainframe-connector/docs/api-command-reference#DataPath) of the QSAM file.\n - \u003cvar translate=\"no\"\u003eOUTPUT\u003c/var\u003e: the [data path](/mainframe-connector/docs/api-command-reference#DataPath) of the Pub/Sub topic you created in step 1. The required format is `pubsub:projects/{project}/topics/{topic}`.\n - \u003cvar translate=\"no\"\u003eTRANSCODE-CONFIG\u003c/var\u003e: the [data path](/mainframe-connector/docs/api-command-reference#DataPath) of the file containing the transcoding configuration. For more information on the transcoder configuration format, see [Transcoder configuration](/mainframe-connector/docs/transcoder-configuration).\n - \u003cvar translate=\"no\"\u003eJSON_CONFIGURATION\u003c/var\u003e: (optional) the [data path](/mainframe-connector/docs/api-command-reference#DataPath) of the [JSON configuration file](/mainframe-connector/docs/json-configuration). If you don't provide a configuration file, the default JSON configuration is used.\n - \u003cvar translate=\"no\"\u003ePUBSUB_CONFIGURATION\u003c/var\u003e: (optional) the [data path](/mainframe-connector/docs/api-command-reference#DataPath) of the [Pub/Sub publish configuration file](/mainframe-connector/docs/pubsub-publish-configuration). If you don't specify a configuration file, the default Pub/Sub configuration is used."]]