{"id":20983156,"url":"https://github.com/pozil/pub-sub-api-java-client","last_synced_at":"2025-05-14T16:32:00.876Z","repository":{"id":51535528,"uuid":"520477257","full_name":"pozil/pub-sub-api-java-client","owner":"pozil","description":"A sample Java gRPC client for the Salesforce Pub/Sub API","archived":true,"fork":false,"pushed_at":"2024-10-09T08:49:05.000Z","size":31,"stargazers_count":12,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T12:52:35.727Z","etag":null,"topics":["avro","grpc","java","pubsub","salesforce"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pozil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-02T11:51:06.000Z","updated_at":"2024-10-09T08:49:17.000Z","dependencies_parsed_at":"2024-11-19T05:51:39.416Z","dependency_job_id":"2cb28215-d392-4f8b-be2b-b54ffc25f2d7","html_url":"https://github.com/pozil/pub-sub-api-java-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fpub-sub-api-java-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fpub-sub-api-java-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fpub-sub-api-java-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fpub-sub-api-java-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pozil","download_url":"https://codeload.github.com/pozil/pub-sub-api-java-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183067,"owners_count":22028416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avro","grpc","java","pubsub","salesforce"],"created_at":"2024-11-19T05:47:57.509Z","updated_at":"2025-05-14T16:32:00.598Z","avatar_url":"https://github.com/pozil.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e This project is archived and no longer maintained. Check out the official [Java Pub/Sub API client example](https://github.com/forcedotcom/pub-sub-api/tree/main/java).\n\n\n# Sample Java gRPC client for the Salesforce Pub/Sub API\n\nSee the [official Pub/Sub API repo](https://github.com/developerforce/pub-sub-api) for more information on the Pub/Sub API.\n\n## Installation\n\nCreate a `config.properties` file at the root of the project:\n\n```properties\nloginUrl=https://login.salesforce.com\nuser.username=YOUR_SALESFORCE_USERNAME\nuser.password=YOUR_SALESFORCE_PASSWORD\nuser.token=YOUR_SALESFORCE_USER_TOKEN\n\npubSub.endpoint=api.pubsub.salesforce.com:7443\npubSub.topicName=/data/AccountChangeEvent\npubSub.eventReceiveLimit=1\n```\n\n\u003e **Warning**\n\u003e This project relies on a username/password Salesforce authentication flow. This is only recommended for test purposes. Consider switching to JWT auth for extra security.\n\nIf using a Change Data Capture topic (like in the sample config), make sure to activate the event in Salesforce Setup \u003e Change Data Capture.\n\nInstall the project with Maven by running: `mvn install`.\n\n## Execution\n\nImport the project in your favorite Java IDE and run the `org.salesforce.demo.PubSubApiClient` class.\n\nIf everything goes well, you'll see output like this:\n\n```\nAug 02, 2022 1:35:06 PM org.salesforce.demo.PubSubApiClient connect\nINFO: PubSub API: retrieving Salesforce session...\nSLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\nAug 02, 2022 1:35:06 PM org.salesforce.demo.auth.AuthenticationHelper login\nINFO: Logged as trail@pozil.com on https://pozil-dev-ed.my.salesforce.com\nAug 02, 2022 1:35:06 PM org.salesforce.demo.PubSubApiClient connect\nINFO: PubSub API: connecting to api.pubsub.salesforce.com:7443...\nAug 02, 2022 1:35:07 PM org.salesforce.demo.PubSubApiClient retrieveTopic\nINFO: PubSub API: retrieving topic /data/AccountChangeEvent...\nAug 02, 2022 1:35:11 PM org.salesforce.demo.PubSubApiClient retrieveTopicSchema\nINFO: PubSub API: retrieving schema for topic /data/AccountChangeEvent...\nAug 02, 2022 1:35:12 PM org.salesforce.demo.PubSubApiClient subscribe\nINFO: PubSub API: subscribing to /data/AccountChangeEvent and waiting for 1 events...\n```\n\nAt this point the script will be on hold and will wait for events.\nOnce it receives events, it will display them like this:\n\n```\nAug 02, 2022 1:36:08 PM org.salesforce.demo.PubSubEventObserver onNext\nINFO: Next event: events {\n  event {\n    id: \"7cb562f2-c7aa-427d-99eb-f2a93b11cdd6\"\n    schema_id: \"vjfSL_rX8hSnqyn0Yla8Zw\"\n    payload: \"\\016Account\\002$0014H00002LbR7QQAV\\000\\002hcom/salesforce/api/soap/55.0;client=SfdcInternalAPI/H0000c8a0-6766-3414-949f-de10519bee7d\\002\\220\\302\\273\\345\\313`\\342\\205\\265\\215\\337\\223\\005$00558000000yFyDAAU\\000\\000\\004\\0200x400000\\f4-0x01\\000\\000\\000\\000\\002\\002\\03412 Main Street\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\220\\302\\273\\345\\313`\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"\n  }\n  replay_id: \"\\000\\000\\000\\000\\001\\004\\266t\"\n}\nlatest_replay_id: \"\\000\\000\\000\\000\\001\\004\\266t\"\nrpc_id: \"db6292ab-3533-45d4-84fc-47c5f47480b3\"\n\nAug 02, 2022 1:36:08 PM org.salesforce.demo.PubSubEventObserver onNext\nINFO: Event raw payload: {\"ChangeEventHeader\": {\"entityName\": \"Account\", \"recordIds\": [\"0014H00002LbR7QQAV\"], \"changeType\": \"UPDATE\", \"changeOrigin\": \"com/salesforce/api/soap/55.0;client=SfdcInternalAPI/\", \"transactionKey\": \"0000c8a0-6766-3414-949f-de10519bee7d\", \"sequenceNumber\": 1, \"commitTimestamp\": 1659440165000, \"commitNumber\": 11334298542449, \"commitUser\": \"00558000000yFyDAAU\", \"nulledFields\": [], \"diffFields\": [], \"changedFields\": [\"0x400000\", \"4-0x01\"]}, \"Name\": null, \"Type\": null, \"ParentId\": null, \"BillingAddress\": {\"Street\": \"12 Main Street\", \"City\": null, \"State\": null, \"PostalCode\": null, \"Country\": null, \"StateCode\": null, \"CountryCode\": null, \"Latitude\": null, \"Longitude\": null, \"Xyz\": null, \"GeocodeAccuracy\": null}, \"ShippingAddress\": null, \"Phone\": null, \"Fax\": null, \"AccountNumber\": null, \"Website\": null, \"Sic\": null, \"Industry\": null, \"AnnualRevenue\": null, \"NumberOfEmployees\": null, \"Ownership\": null, \"TickerSymbol\": null, \"Description\": null, \"Rating\": null, \"Site\": null, \"OwnerId\": null, \"CreatedDate\": null, \"CreatedById\": null, \"LastModifiedDate\": 1659440165000, \"LastModifiedById\": null, \"Jigsaw\": null, \"JigsawCompanyId\": null, \"CleanStatus\": null, \"AccountSource\": null, \"DunsNumber\": null, \"Tradestyle\": null, \"NaicsCode\": null, \"NaicsDesc\": null, \"YearStarted\": null, \"SicDesc\": null, \"DandbCompanyId\": null, \"CustomerPriority__c\": null, \"SLA__c\": null, \"Active__c\": null, \"NumberofLocations__c\": null, \"UpsellOpportunity__c\": null, \"SLASerialNumber__c\": null, \"SLAExpirationDate__c\": null, \"Potential_Value__c\": null, \"Match_Billing_Address__c\": null, \"Number_of_Contacts__c\": null, \"Region__c\": null}\nAug 02, 2022 1:36:08 PM org.salesforce.demo.PubSubEventObserver onNext\nINFO: Event replay ID: 17086068\nAug 02, 2022 1:36:08 PM org.salesforce.demo.PubSubEventObserver onNext\nINFO: UPDATE operation on Account with record ID 0014H00002LbR7QQAV\nAug 02, 2022 1:36:08 PM org.salesforce.demo.PubSubEventObserver onNext\nINFO: Changed fields: LastModifiedDate,BillingAddress.Street\n```\n\nNote that the event payload includes all object fields but fields that haven't changed are null.\nUse the values from `ChangeEventHeader.nulledFields`, `ChangeEventHeader.diffFields` and `ChangeEventHeader.changedFields` to identify actual value changes.\n\nAfter receiving the number of requested events (see `pubSub.eventReceiveLimit`), the script will terminate with these messages:\n\n```\nAug 02, 2022 1:37:09 PM org.salesforce.demo.PubSubEventObserver onCompleted\nINFO: Done receiving events.\nAug 02, 2022 1:37:09 PM org.salesforce.demo.PubSubApiClient disconnect\nINFO: PubSub API: disconnecting...\nAug 02, 2022 1:37:09 PM org.salesforce.demo.PubSubApiClient main\nINFO: PubSub API: client disconnected.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozil%2Fpub-sub-api-java-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpozil%2Fpub-sub-api-java-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozil%2Fpub-sub-api-java-client/lists"}