Mainframe Connector를 사용하면 메인프레임에서 Pub/Sub에 메시지를 게시할 수 있습니다. 예를 들어 이 기능을 사용하여 메인프레임을 BigQuery 또는 Cloud Storage와 통합하거나, Dataflow로 메시지 데이터를 보강하거나, Cloud Run 함수를 트리거할 수 있습니다.
TOPIC을 Pub/Sub 주제의 이름으로 바꿉니다. 필요한 형식은 projects/{project}/topics/{topic}입니다.
Pub/Sub 주제에 메시지 게시
Mainframe Connector를 사용하면 메인프레임에서 Pub/Sub 주제로 구조화된 메시지를 게시할 수 있습니다. 예를 들어 이 기능을 사용하여 Pub/Sub을 통해 메인프레임에서 BigQuery로 Queued Sequential Access Method (QSAM) 레코드를 전송할 수 있습니다. 이 접근 방식을 사용하면 다음과 같은 이점이 있습니다.
Dataflow 또는 Pub/Sub 동시 멀티스레딩 (SMT)을 통해 AI로 데이터를 변환하거나 데이터를 보강할 수 있습니다.
레코드를 메인프레임에서 Cloud Storage로 이동할 수 있습니다.
변경 데이터 캡처 (CDC)와 마찬가지로 메인프레임 애플리케이션 업데이트를 클라우드 기반 시스템에 동기화할 수 있습니다.
메인프레임에서 Pub/Sub 주제에 구조화된 메시지를 게시하려면 다음 단계를 따르세요.
메시지를 게시할 Pub/Sub 주제를 만듭니다. 원하는 경우 스키마를 사용하여 주제를 만들어 더 많은 제한사항을 적용할 수 있습니다. 자세한 내용은 주제 만들기 또는 주제를 만들 때 스키마 만들기 및 연결하기를 참고하세요.
트랜스코딩에 실패한 레코드에 관한 정보를 캡처하는 Pub/Sub 주제를 만듭니다. 이러한 주제를 스필오버 주제라고 합니다. Pub/Sub 주제 만들기에 관한 자세한 내용은 주제 만들기를 참고하세요.
(선택사항) 레코드를 Pub/Sub으로 전송하기 전에 JSON으로 변환하려면 JSON 구성 파일을 구성합니다.
구성 파일을 제공하지 않으면 기본 JSON 구성이 사용됩니다.
(선택사항) 기본적으로 Pub/Sub 메시지에는 순서 키와 속성이 포함되지 않습니다. 오버플로 메시지는 _spillover 접미사가 있는 오버플로 주제로 전송됩니다. 기본값을 변경하려면 Pub/Sub 게시 구성 파일을 구성하면 됩니다. 예를 들어 다음 구성을 사용할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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."]]