Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Pushing data from Google Cloud Pub/Sub into an Apigee proxy

I want to push data from Google Cloud Pub/Sub into an Apigee proxy.

I know Receiving message using push in google pubsub is the best option. Can anyone guide me?

Solved Solved
1 7 2,751
1 ACCEPTED SOLUTION

Great question! Using Edge to consume pubsub messages is easy to setup and showcases versatility of the tool as well as the power of integration of involved technologies.

Create proxy with domain verify endpoint

1. Go to the URL https://www.google.com/webmasters/verification of your gcp account.

https://dbcedge-eval-test.apigee.net/push-handlers

2. Notice html verification file and download it.

3. Keep this page open.

Setup listening proxy

1. Create push-handlers No Target proxy with proxy base path push-handlers. Passthrough. Virtual Host: Secure. Environment: test. Build and Deploy.

2. In DEVELOP add new flow with the name of the html verification file, in our case: [google8343a21f428165ca.html

3. Add Assign Message for the GET html flow to the PreFlow RESPONSE. Populate Payload with the contents of the verification file and contentType text/plain.

4. Save and Deploy the proxy.

5. At the Webmaster Central page you hopefully still have opened, click on I'm not a robot reCAPTCHA and VERIFY button.

You should receive the url is verified message

Configuring http endpoint

Create pubsub topic

1. Create topic books

2. Press CREATE

Add Domain verification entry

1. In the API & Services select Credentials page. Select Domain Verification tab. Click Add domain. Add the domain URL (no protocol).

dbcedge-eval-test.apigee.net/push-handlers/

Register endpoint

1. In the books topic's menu, select + New Subscription item.

2. Populate subscription name bookssubscription; Delivery Type: Push into an endpoint url; enter the url without protocol (https is the only expected option): dbcedge-eval-test.apigee.net/push-handlers/. Press Create button.

Your subscription is created.

Testing pubsub push message

1. In the Edge UI, start tracing session for the push-handlers proxy.

2. In the pubsub books topic, chose Publish message

3. Enter sample message, ie: Test message. and a sample key-value attribute: key, val. Press Publish button.

4. In the Tracing session page, you should see your messages request

5. You can see the key/val field as well as data property. As the message's data field is base64 encoded, we can use a base64 decoder to validate it: ,"data":"VGVzdCBtZXNzYWdlLg=="

View solution in original post

7 REPLIES 7