Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mainframe Connector memungkinkan Anda memublikasikan pesan ke Pub/Sub
dari mainframe. Anda dapat menggunakan fitur ini, misalnya, untuk mengintegrasikan mainframe dengan BigQuery atau Cloud Storage, menambah data pesan dengan Dataflow, atau memicu fungsi Cloud Run.
Untuk menjalankan perintah Pub/Sub, pastikan Anda menetapkan peran Pub/Sub Publisher ke akun pengguna Anda. Untuk informasi tentang cara menetapkan peran ke akun pengguna, lihat Mengelola akses menggunakan IAM.
Ganti TOPIC dengan nama topik Pub/Sub. Format yang diperlukan adalah projects/{project}/topics/{topic}.
Memublikasikan pesan ke topik Pub/Sub
Mainframe Connector memungkinkan Anda memublikasikan pesan terstruktur dari mainframe ke topik Pub/Sub. Misalnya, Anda dapat menggunakan kemampuan ini untuk mentransfer data Queued Sequential Access Method (QSAM) dari mainframe ke BigQuery menggunakan Pub/Sub. Berikut beberapa
keuntungan menggunakan pendekatan ini:
Anda dapat mengubah data atau meningkatkan data dengan AI melalui Dataflow atau
melalui multithreading simultan (SMT) Pub/Sub.
Anda dapat memindahkan data dari mainframe ke Cloud Storage.
Anda dapat menyinkronkan update aplikasi mainframe ke sistem berbasis cloud
yang mirip dengan pengambilan data perubahan (CDC).
Untuk memublikasikan pesan terstruktur dari mainframe ke topik Pub/Sub, gunakan langkah-langkah berikut:
Buat topik Pub/Sub untuk mengambil informasi tentang data yang gagal ditranskode. Topik ini disebut topik spillover. Untuk mengetahui informasi tentang cara membuat topik Pub/Sub, lihat Membuat topik.
(Opsional) Untuk mengonversi data ke JSON sebelum mengirimnya ke Pub/Sub, konfigurasikan file konfigurasi JSON.
Jika Anda tidak memberikan file konfigurasi, konfigurasi JSON default akan
digunakan.
(Opsional) Secara default, pesan Pub/Sub tidak berisi kunci
urutan, dan atribut. Pesan tambahan dikirim ke topik tambahan
dengan akhiran _spillover. Untuk mengubah setelan default, Anda dapat mengonfigurasi file konfigurasi publikasi Pub/Sub. Misalnya, Anda dapat menggunakan konfigurasi berikut:
Ganti SPILLOVER_TOPIC_NAME dengan nama
topik tambahan yang Anda buat di langkah 2. Format yang diperlukan adalah
projects/{project}/topics/{topic}. Informasi tentang pesan
yang tidak didekode dengan benar disimpan ke topik tambahan ini.
Untuk memublikasikan data mainframe ke Pub/Sub menggunakan
perintah qsam decode, jalankan JCL berikut:
OUTPUT: jalur data
topik Pub/Sub yang Anda buat di langkah 1. Format
yang diperlukan adalah pubsub:projects/{project}/topics/{topic}.
TRANSCODE-CONFIG: jalur data
file yang berisi konfigurasi transcoding. Untuk mengetahui informasi selengkapnya tentang
format konfigurasi transcoder, lihat Konfigurasi transcoder.
JSON_CONFIGURATION: (opsional)
jalur data dari
file konfigurasi JSON. Jika
Anda tidak memberikan file konfigurasi, konfigurasi JSON default akan
digunakan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]