<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Megan Potter on Medium]]></title>
        <description><![CDATA[Stories by Megan Potter on Medium]]></description>
        <link>https://medium.com/@feywind?source=rss-cf0009f94ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xqjnop_ETagUebj1KPXF6Q.png</url>
            <title>Stories by Megan Potter on Medium</title>
            <link>https://medium.com/@feywind?source=rss-cf0009f94ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 08 Jun 2026 23:15:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@feywind/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[A new major version for the Node client library for Pub/Sub]]></title>
            <link>https://medium.com/google-cloud/a-new-major-for-the-node-client-library-for-pub-sub-7ed84727bb29?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ed84727bb29</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[pub-sub]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 21:05:49 GMT</pubDate>
            <atom:updated>2025-04-29T01:49:25.540Z</atom:updated>
            <content:encoded><![CDATA[<p>5.0.0 is here.</p><p>The big story for this library is that we’re moving to a minimum engine version of Node 18 and upgrading a ton of dependencies in accordance. But there are a few things that aren’t fully covered by the changelog, and these are worth calling out here:</p><ul><li><strong>ECMA compliance</strong>. We are now linting for dangling Promises (ones with no catch handler). Where possible, the cases this found were fixed to do something useful, and where that fix would’ve been non-trivial, we have added the void keyword for now.</li><li><strong>Upgraded TypeScript compiler</strong>. (5.8.3)</li><li><strong>Newly auto-generated gRPC classes</strong>. These underlie the higher level wrapper functionality that most users use. A really notable change here is support for request/response debug logging, for which I should probably write a whole separate blog.</li></ul><p>Some changes are considered <strong>breaking</strong>, and may cause users to need to update their code. We always try to keep these to a minimum, but sometimes they just make sense:</p><ul><li>We had an old and somewhat broken implementation of OpenTelemetry tracing, implemented well before most of the other libraries (and well before we really knew exactly how we wanted to handle this important functionality). The <strong>legacy OpenTelemetry support</strong> was supported for quite a while, but that <strong>has now been removed</strong>. The new support uses the current standards with propagators as Pub/Sub message attributes.</li><li><strong>Legacy ack deadline options were removed</strong>. In the past, users could set ackDeadline by itself to fix the deadline at a number of seconds. This has been replaced by two knobs in the SubscriberOptions: minAckDeadline and maxAckDeadline. These have been used for a while with exactly-once delivery, but now they are the standard for all ack deadline limiting. These use our extremely lightweight polyfill for tc39’s Temporal Duration class, which will eventually be removed in favour of the real implementation.</li><li>The FlowControlOptions setting maxExtension was renamed to <strong>maxExtensionMinutes</strong> for clarity, and maxExtension remained a compatibility shim. With a major, we are removing both of these and <strong>adding a new setting to SubscriberOptions (next to the *AckDeadline settings) called maxExtensionTime</strong>. This is also a modern Duration value to remove ambiguity about the time units.</li></ul><p>As usual, if you have problems with the library itself, please post an issue or a discussion topic on <a href="https://github.com/googleapis/nodejs-pubsub">the GitHub repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ed84727bb29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/a-new-major-for-the-node-client-library-for-pub-sub-7ed84727bb29">A new major version for the Node client library for Pub/Sub</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Major versions in the Node Cloud SDKs]]></title>
            <link>https://feywind.medium.com/major-versions-in-the-node-cloud-sdks-d5267180f429?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5267180f429</guid>
            <category><![CDATA[developer-relations]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 17:02:24 GMT</pubDate>
            <atom:updated>2023-07-26T17:02:24.486Z</atom:updated>
            <content:encoded><![CDATA[<p>A <a href="https://github.com/googleapis/nodejs-pubsub/issues/1768">question</a> came up recently in regards to major version releases on the Node Pub/Sub library. To boil it down, what is our thought process on when and how to release a major, breaking change for a library? In this particular case, the question was centred around the end of Node 12 support.</p><blockquote><strong>Disclaimer up front</strong>: This blog post isn’t the official word on anything; please, always check cloud.google.com for <a href="https://cloud.google.com/apis/docs/resources/enterprise-apis">official answers and policies</a>.</blockquote><blockquote>Note that the link above is about the APIs themselves, not client libraries — but we try to follow them for client libraries, too. Also note that what I’m talking about here is “end of support” rather than “deprecation”. The former is about how many person-hours we spend on maintaining older code, and the latter is about discontinuing it entirely.</blockquote><blockquote>In any case, I wanted to try to demystify this topic a little bit, in friendly, non-corporate language.</blockquote><p>First, I’d like to link to this article that my colleague wrote, and which I poked at a little bit, too:</p><p><a href="https://cloud.google.com/blog/products/application-development/google-cloud-sdk-moves-nodejs-10-to-maintenance-mode">Google Cloud SDK moves Node.js 10 to maintenance mode | Google Cloud Blog</a></p><p>There have been some deviations from this because of our much longer than expected cycle to drop Node 12, but what that article says is essentially still our intent as developer relations and Cloud SDK. (It is also very similar to the <a href="https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-node-js-12-x-in-the-aws-sdk-for-javascript-v3/">policies at AWS</a>, for example.) TL;DR, we want to support Node versions for 6 months past Node declaring them as unsupported.</p><p>I think that all of us know that, for customers and users, dropping support for things willy-nilly is extremely frustrating. Before I worked at Google, I worked at other companies just trying to make the best of still other companies’ APIs and SDKs. It’s part of our job as DevRel to feel your pain there and try to drive change if we can. It’s something I was excited about back when I interviewed.</p><p>Unfortunately, for Node specifically, we don’t get a huge amount of choice in the matter — V8, JavaScript, Node, and even TypeScript are fairly stable and backwards-compatible now. But the vast npm package ecosystem is not. Many prominent packages will bump their required engine versions <em>on the day</em> of the Node engine maintenance ending. This often means that there are no more security patches or fixes on the branch that supported the version <em>we</em> need to support. Security vendors quickly come behind and remind us of that fact. :)</p><p>And you can imagine that there is a transitive network effect — the packages that depend on those packages may be forced to upgrade the required engine, and so on. That’s just the uncontrollable fact of a huge open source ecosystem.</p><p>So here is what we’ve got, currently.</p><p>The three pillars (ugh) of this are:</p><ol><li><strong>We intend to support Node maintenance versions 6 months past their “best by” date</strong>. As the linked article says, “This may vary depending on critical security patches”. This means that, even if we make a new major/breaking version that requires the next Node version, we intend to do our best to keep supporting the previous one for 6 months; but ideally, we also prefer not to make that new major until the time window has passed. But see above, re: npm — there may still be circumstances that prevent us from doing exactly what we need to do.</li><li><strong>We aim to minimize mandatory API changes</strong>. No one likes to rewrite their code for a new library version. There’s no one-size-fits-all answer to this problem, because sometimes changes simply do have to be made. But e.g. for the area I work most in (Pub/Sub) we try super hard to make all of the raw RPCs backwards compatible, and though we have some new SDK APIs planned, these are (a) meant to be pretty close the existing ones, and (b) planned to include a compatibility layer that will let you work with minimal changes for a while. We want to reduce your friction and pain for using our services. The Pub/Sub SDK team is pretty on board with this idea, because it lets us evolve without breaking all of your apps, but we’ve been advocating to other teams, as well, and it’s an idea that has been well-received.</li><li><strong>We want to minimize “major churn fatigue”</strong>. <a href="https://semver.org/">Semver</a> lets us make new major versions whenever something might break, but there is an internal culture of trying to avoid too many of these in a small time window.</li></ol><p>So, to summarize, this is a hard problem; but we are all interested in trying to find good compromises, going forward. And hopefully this post will help to understand the mindset behind some of these releases and actions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5267180f429" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Boring Show]]></title>
            <link>https://feywind.medium.com/the-boring-show-1b7a21b6cb38?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b7a21b6cb38</guid>
            <category><![CDATA[pandemic]]></category>
            <category><![CDATA[google-devrel]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 20:21:59 GMT</pubDate>
            <atom:updated>2021-08-30T20:21:59.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="On the left, a picture of Manhattan and “expectation”. On the right, a dubious Googler at home with static and “Buffering”." src="https://cdn-images-1.medium.com/max/1024/0*S_oi_CXRODzMpcc0" /></figure><p><em>This is an opinion piece, and the views expressed in this post are my own, not my employer (Google)</em></p><h3>Interesting times</h3><p>I started at Google in DevRel just a short time before the pandemic ramped up to its early terror. I ended up doing my Noogler (you can probably guess, but it’s one of the many -<em>oogler</em> nicknames, in this case for new hires) orientation at the New York office. You might have heard stories about our offices — living walls, arcade games, scooters in the hallways, many cafes with free food. Well, in reality… it’s exactly like that, yeah. :) The left half of the banner image above is a picture I took from the terrace outside one of the NYC-9TH cafeterias. It’s a really phenomenal place.</p><p>There’s a truism about Google that Nooglers almost universally come in with “imposter syndrome”. The short version explanation of that term is… take it away, Wayne and Garth.</p><figure><img alt="Wayne and Garth from Wayne’s World, with the caption “We’re not worthy!”" src="https://cdn-images-1.medium.com/max/512/0*qGTwmBEKV49Nd7pt" /></figure><p>Google has a kind of glass tower reputation (and a monolithic facade) that I think makes it feel inaccessible to other developers. One of the functions of developer relations, at least in my mind, is to dispel some of this aura, to be in both your corner and ours. I do honestly believe that this is a special place (one of the best I’ve worked at), but at the end of the day, we are also just trying to make stuff that works, and more importantly, make stuff that works for <em>you</em>.</p><h3>The Boring Show</h3><p>Getting back to the title of my post, I’d like to bring up something really cool that the Flutter/Dart developer relations folks are doing: <a href="https://www.youtube.com/watch?v=qdIyYeZcadA">The Flutter Boring Show</a>. The idea behind this effort is to drop the contrived examples / marketing / what-have-you, and focus on really hard, real world problems that are baffling both outside developers and our own. This is what we offer to people applying to work at Google (solve real world, really hard problems!) and I believe that we should offer it to all of you, as well. Our goal, then, is to take care of some of that complexity for you, so that you can focus on the hard problems that make your own work unique and interesting.</p><p>As part of DevRel engineering, my primary task is to make the libraries that interface with our services work well for you. That includes adding new features, looking at bug reports, and helping out with customer cases. My other primary task :) is to bi-directionally advocate:</p><ul><li>Helping users understand why things are the way we’ve designed them</li><li>Helping us understand why things should be designed differently</li><li>Trying to broker compromises between those positions</li></ul><p>To that end, some focus has recently been placed on making full, end-to-end examples. A quick snippet of sample code and good documentation go a long way toward getting you started, which is really important; but in the end, you also need to know how to connect the pieces together, and where to go next.</p><p>These are all really important to us as Googlers. I can only speak for myself, but my impression is that it’s a shared aspiration — we really want to help you succeed, and nothing is more delightful than hearing that you have.</p><h3>Buffering…</h3><p>I’ll close out by talking about the right half of that banner image at the top. When the rubber hits the road, as they say, things get messy. Nothing in my lifetime has been as messy as trying to persevere and thrive through a global pandemic. I experienced a few scant months of that fabulous Google office life before we all started working from home. Network issues, cats taking over the camera frame, suddenly having to run to help the kids who are stuck at home.</p><p>As I say at the top, I can’t speak for my employer, only my own views and perceptions. But everyone I work with is dedicated to continuing to improve your experiences on our platform, as well as your own! We don’t always hit the mark (again, my opinion). It’s a given, and humility toward improving and doing better without drama is an internal virtue we try to export. We try, but, well… we are people too. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b7a21b6cb38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Cloud Pub/Sub on Node.js from Elm]]></title>
            <link>https://medium.com/google-cloud/using-cloud-pub-sub-on-node-js-from-elm-2a769731c097?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a769731c097</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[elm-lang]]></category>
            <category><![CDATA[google-pubsub]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 22:32:30 GMT</pubDate>
            <atom:updated>2021-06-17T22:39:04.900Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*8D8MqXpumqfLKXuiPnKD1w.png" /></figure><figure><img alt="Node.js logo" src="https://cdn-images-1.medium.com/max/245/0*qk_LpjAlkjXOY-ci" /></figure><figure><img alt="Cloud Pub/Sub logo" src="https://cdn-images-1.medium.com/max/335/0*1Dq0AeMea7LH3tQK" /></figure><h3>Why Elm?</h3><p><a href="https://elm-lang.org/">Elm</a> is a pure functional language with a syntax similar to <a href="https://www.haskell.org/">Haskell</a>, but optimized for writing front-end web applications. It has a transpiler that converts Elm modules into JavaScript, as well as a very small and fast runtime to interface with browsers.</p><p>Elm is pretty firmly positioned as a front-end tool, to make dynamic, single-page applications for browsers. But with the help of the <a href="https://www.npmjs.com/package/elm-node">elm-node package</a>, much more is possible!</p><h3>Caveats</h3><p>This article will walk you through building an Elm application that runs in Node.js, and uses the Node.js Pub/Sub libraries for communicating with <a href="https://cloud.google.com/pubsub">Google Cloud Pub/Sub</a>. Please note that <strong>we do not recommend doing this for your production work at this time</strong>; this article is mostly for the curious!</p><h3>Why “pure functional”?</h3><p>Many of us are familiar with basic <a href="https://en.wikipedia.org/wiki/Functional_programming">functional patterns</a>, like passing a lambda function to <em>map()</em> in JavaScript.</p><p><a href="https://en.wikipedia.org/wiki/Purely_functional_programming"><strong>Pure functional</strong></a> refers to programs that describe what it is that you want to figure out, declaratively. Most programs are written in an <a href="https://en.wikipedia.org/wiki/Imperative_programming">imperative fashion</a>, which is to say that you, as the programmer, are telling the computer what steps to take, and in what order, and managing the state of the program. This introduces a great burden on the programmer, because one must constantly think about how to maintain the consistency of state, as well as what might go wrong to handle unexpected errors from unknown side-effects.</p><p>JavaScript tools have been developed to help with the state problem at least, such as <a href="https://redux.js.org/">Redux</a>, whose model was <a href="https://redux.js.org/understanding/history-and-design/prior-art#elm">inspired by Elm</a>. Redux lets you declare your program’s state as an immutable structure that is updated using mutators. However, many things can still go wrong at runtime, because the compiler isn’t helping you to understand the possible flows through the logic.</p><p>A truly pure functional language has no flow control. There are no steps to run, and since your program is basically a mathematical equation, the compiler is able to fully understand it, and catch most logic errors at compile time. In fact, it is even possible to <a href="https://www.cs.princeton.edu/~dpw/courses/cos326-12/notes/reasoning.php">write proofs about pure functional programs</a>.</p><h3>Elm … on Node?</h3><p>Because Elm is simply a transpiler, it’s also possible to run the resulting code using the Node.js runtime, rather than a browser. This gives you the ability to build very lightweight server processes using all of the existing Node compatible libraries from npm/yarn, while staying in Elm for as much of the application as you like. Elm’s lack of side effects also means that many logic and data structure modules can be shared between client and server.</p><p>This article will walk you through building an Elm application that runs in Node.js, and uses the <a href="https://github.com/googleapis/nodejs-pubsub/">Node.js Pub/Sub libraries</a> for communicating with <a href="https://cloud.google.com/pubsub">Google Cloud Pub/Sub</a>.</p><blockquote><strong>My series of “Using Pub/Sub From” articles:<br></strong><a href="https://medium.com/google-cloud/using-cloud-pub-sub-from-kotlin-d501f7d65e24">Using Cloud Pub/Sub from Kotlin</a><br><a href="https://medium.com/google-cloud/using-cloud-pub-sub-on-node-js-from-kotlin-js-46ad79739bbf">Using Cloud Pub/Sub on Node.js from Kotlin/JS</a></blockquote><blockquote><strong>Also of interest:</strong><br><a href="https://medium.com/google-cloud/things-i-wish-i-knew-about-google-cloud-pub-sub-852fac1ffbc6">Things I wish I knew about Google Cloud Pub/Sub: Part 1</a></blockquote><h3>Project setup</h3><p>Begin by installing a recent version of <a href="https://nodejs.org/en/">Node.js</a>. (Or using <a href="https://github.com/nvm-sh/nvm">nvm</a>!)</p><p>You will also want the commands for Elm and elm-node, so install them globally:</p><pre>npm install -g elm elm-node</pre><p>You can then create an elm-node project:</p><pre>elm init<br>elm-node --example-elm &gt; src/Main.elm<br>elm-node --example-js &gt; src/index.js<br>elm-node --js src/index.js src/Main.elm</pre><p>Right away, I found an error in the generated sample code — <strong>index.js</strong> needs to refer to <em>Elm.Main</em>, not <em>Elm.MainWithJs</em>. These types of errors may be fixed by the time you try it.</p><p>The generated program is extremely simple. Some program declarations are made in Elm, including a <strong>port</strong> to talk with JavaScript. The JavaScript code then subscribes to the port and responds to calls.</p><h3>App design</h3><p>Because Elm and JavaScript are interfacing across two <em>very</em> different kinds of coding, we need to think about how they will communicate. The <a href="https://guide.elm-lang.org/interop/ports.html">Elm guide</a> discusses this in light detail. The recommendation is essentially to try to avoid piping every JavaScript call through to Elm. Instead, make an interface that makes sense in Elm. This also helps with the Elm/JavaScript transition, which relies on passing nothing more complicated than JSON. (No object handles or anything.)</p><p>For this very simple example, I’ve chosen to expose an interface to Elm that lets the Elm code request that messages be sent or ack’d, and then is able to receive messages in an event-driven manner. For a real application, you’d probably need something more complex, like passing numbers or JSON across to refer to specific topics or subscriptions, and caching those with a Map on the JavaScript side.</p><p>The ultimate recommendation of the Elm designers is to rewrite client libraries in native Elm, but given the size and complexity of the Node Pub/Sub libraries, this is probably not feasible at this time. So we will use ports!</p><h3>Port definitions</h3><p>The place we must start here is to define our ports. To define our ports, we must first decide what sort of capabilities and interface we want to have on the Elm side. How much will be declared in Elm, and how much will reside in JavaScript/TypeScript?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32fcf58d52730c755549a44966c642ac/href">https://medium.com/media/32fcf58d52730c755549a44966c642ac/href</a></iframe><p>Let’s briefly pick this apart a bit!</p><p>First, we have the definitions of the messages we will be passing back and forth. Our message payload for this example will be a simple string, so the <em>MessageToSend</em> will simply be an alias for <em>String</em>. When receiving a message, we must also know the Pub/Sub message ID, so <em>MessageReceived</em> has both the payload and the ID.</p><p>The ports themselves are basically declarations of messages that may be passed between Elm and JavaScript. The <em>log</em> port will let us print log messages, <em>publish</em> lets us ask for a message to be sent, <em>receive</em> goes from JavaScript to Elm for a received message, and <em>ack</em> lets us ack a Pub/Sub message. One thing to note is that I’ve chosen to make the parameter to <em>publish</em> a <strong>record</strong> rather than just a string. This is to make it simpler to add more parameters later on, if we wanted to.</p><p>You can see that the messages that go from Elm to JavaScript are functions returning type <em>Cmd msg</em>. This is a generic type that specifies a command the Elm program requests in order to get to the next state. Messages from JavaScript to Elm use <em>Sub msg</em>, which is a function returning type <em>Sub msg</em>. This means that we are subscribing to messages with a parameter type of <em>MessageReceived</em>, and will use those to trigger a state update.</p><h3>Elm model</h3><p>Now that we’ve defined our ports, let’s define our Elm-side model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ce01a2bd7ef47ae76213bfa948a4d21/href">https://medium.com/media/9ce01a2bd7ef47ae76213bfa948a4d21/href</a></iframe><p>In this case, our very simple example is just sending one word of this sentence at a time (thus <em>toSend</em> for what’s left to send, and <em>receivedMessage</em> for what we’ve received). Also, we define <em>Msg</em> here as the type we will take in to trigger a state update. In this case, the only message we’ll receive is <em>Received</em>, with a parameter of type <em>MessageReceived</em>. But you might have others here in a more complex application.</p><h3>Elm Main</h3><p>If this looks more like a data structure than a program, you wouldn’t be wrong! In Elm, they are one and the same.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11a2db29fcbb418d66525a8a91f633ef/href">https://medium.com/media/11a2db29fcbb418d66525a8a91f633ef/href</a></iframe><p>The main symbol we export in this Elm module is <em>main</em>, and it will be a <em>worker</em> program (no UI). The <em>init</em> function will specify the initial state. The <em>subscriptions</em> function will list the messages we’re willing to receive. And <em>update</em> will define how to get an updated state from a received message, as well as further actions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ce5dbf3c0368cacdbfc537c6708dc5/href">https://medium.com/media/14ce5dbf3c0368cacdbfc537c6708dc5/href</a></iframe><p>This defines the <em>init</em> function, which returns a <strong>tuple</strong>. This includes the initial state (<em>toSend</em> has all but the first word, and <em>receivedMessage</em> hasn’t received any yet) as well as next steps to take. The <em>Cmd.batch</em> function builds an array of commands to execute, in any order, probably all at once. Note that these are our <strong>ports</strong> from above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eedb8ad8423ccbafef503c5c5df86c93/href">https://medium.com/media/eedb8ad8423ccbafef503c5c5df86c93/href</a></iframe><p>This one is very simple! We’re simply saying that we are able to receive message type <em>Received</em> (defined above as part of <em>Msg</em>).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb093ec6cfc98ef7ffffb9987d03f4d0/href">https://medium.com/media/bb093ec6cfc98ef7ffffb9987d03f4d0/href</a></iframe><p>This is the core of the logic in the Elm app. Basically when the Elm app is passed type <em>Received</em> with a message (again, defined above) and a previous state model, we will return a new model. The model will update <em>toSend</em> to be one fewer word than the previous model; we will also add the new received word to <em>receivedMessage</em>. (Note that these updates are not done in-place, but this is returning a <em>new</em> model; so we must use <strong>let</strong> if we want those values right away.) Finally, the <em>Cmd</em> batch will print out what we’ve received, ack the message in Pub/Sub, and potentially publish the next word. (All of which may happen at once, in any order.) If there’s nothing left to send, then no further commands are issued.</p><h3>Running the app</h3><p>Your process will no doubt vary here, but for the complete sample, I have created an <strong><em>npm run</em></strong> script that you can use to start it. You should see something like this:</p><pre>&gt; npm run run<br>[…]<br>Use Ctrl+C to exit.<br>Elm starting Pub/Sub Elm test<br>JS publishing: Mary<br>JS: received: 1 : Mary<br>Elm received so far: ‘Mary’<br>JS publishing: had<br>JS acking: 1<br>JS: received: 2 : had<br>Elm received so far: ‘Mary had’<br>[…etc…]</pre><p>Note that, because our app is publishing messages sequentially, the final message string will always be in order. A nice exercise for the reader would be to have it publish more than one message (one per word) at a time, and you can see that they may come out of order. From there, you might play with assembling them in order again, and so on.</p><h3>Next steps</h3><p>Check out a full working example that runs on the Pub/Sub emulator:</p><p><a href="https://github.com/feywind/elm-node-pubsub">https://github.com/feywind/elm-node-pubsub</a></p><p>Have you used Elm on the server side with Node.js? Do you find this interesting and wish to hear more? Please feel free to leave a comment about this post or things that you find interesting/promising in regards to Elm on Google Cloud Platform!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a769731c097" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/using-cloud-pub-sub-on-node-js-from-elm-2a769731c097">Using Cloud Pub/Sub on Node.js from Elm</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Cloud Pub/Sub on Node.js from Kotlin/JS]]></title>
            <link>https://medium.com/google-cloud/using-cloud-pub-sub-on-node-js-from-kotlin-js-46ad79739bbf?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/46ad79739bbf</guid>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[kotlin-js]]></category>
            <category><![CDATA[google-pubsub]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 21:47:01 GMT</pubDate>
            <atom:updated>2021-06-01T22:42:24.046Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/174/0*iGV7ScBFk4K5_G8Q" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*4M0nuzReVcFZCBa4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/0*ARUQelkPpC1LwNFN" /></figure><h3>Why Kotlin/JS?</h3><p>Kotlin is commonly used for front-end JVM work, but as shown in <a href="https://feywind.medium.com/using-cloud-pub-sub-from-kotlin-d501f7d65e24">the previous post about Kotlin and the JVM</a>, Kotlin can work quite well on the server side as well. In order to maintain a full Kotlin stack in a web application, <a href="https://kotlinlang.org/docs/reference/js-overview.html">Kotlin/JS</a> was developed.</p><p>Kotlin/JS is basically a standard Kotlin compiler, but instead of writing to JVM bytecode, it transpiles* into JavaScript. It serves much the same purpose in this situation as TypeScript, providing type safety and syntactic sugar to some common operations. Like TypeScript, it also provides a concept of external typings for JavaScript libraries. Using the Dukat utility, one may also convert TypeScript typings into Kotlin typings, making it very easy to get full type safety in a Kotlin/JS application.</p><blockquote>* Transpilation is like compilation, but converting from one human-readable language to another, rather than binary code.</blockquote><p>With Kotlin on both the client and server side, generally using React and a JVM, respectively, it’s possible to share some code directly, like generic business logic and data classes. It’s also possible to leverage existing competencies in Kotlin for a team developing a vertical application stack.</p><h3>Kotlin/JS … on Node?</h3><p>Yes, it’s true! Because Kotlin/JS is simply a transpiler, it’s also possible to run the resulting code using the Node.js runtime. This gives you the ability to <strong>build very lightweight server processes using all of the existing Node compatible libraries from npm/yarn, while staying in Kotlin for the whole application</strong>.</p><h3>Caveats</h3><p>This article will walk you through building a Kotlin/JS application that runs in Node.js, and uses the Node.js Pub/Sub libraries for communicating with <a href="https://cloud.google.com/pubsub">Google Cloud Pub/Sub</a>. Please note that <strong>we do not recommend doing this for your production work at this time</strong>; this article is mostly for the curious!</p><h3>Project setup</h3><p>Begin by installing a recent version of <a href="https://nodejs.org/">Node.js</a>. You may also install it using <a href="https://github.com/nvm-sh/nvm">nvm</a>, but you’ll need to set the path to npm in the project settings below.</p><p>Open either <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a> or <a href="https://developer.android.com/studio">Android Studio</a> and create a Kotlin/JS project targeted at Node.js. As of this time, the new <strong>IR</strong> compiler is still experimental, so I recommend using <strong>LEGACY</strong> to keep things simple. (By the time you read this, that may not be the case.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lDPM1hYFH8zzTfVh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yrc917IvdWKtxWCS" /></figure><p>To work with the Pub/Sub libraries, we must add them to our Gradle build configuration. Edit the <strong>build.gradle.kts</strong> file, and add the following line:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4be179236aae9e600583d1da1ca8e4b/href">https://medium.com/media/f4be179236aae9e600583d1da1ca8e4b/href</a></iframe><p>As the comment suggests, you could normally enable generateExternals, and it would invoke Dukat for you to automatically convert any TypeScript typings in <strong>@google-cloud/pubsub</strong>. Unfortunately, <a href="https://github.com/Kotlin/dukat/issues/426">it is currently failing</a>, so we’ll make our own very simple typings!</p><h3>Kotlin/JS Typings</h3><p>In order to call the <a href="https://github.com/googleapis/nodejs-pubsub">Pub/Sub library</a> in a type-safe way, we need to add some typings. I like to create a file with the same naming convention as TypeScript, such as <strong>pubsub.d.kt</strong>, but your tastes may vary.</p><p>Begin the file <strong>pubsub.d.kt</strong> like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dd41ce719188b678dbbc8b078c0daa6/href">https://medium.com/media/7dd41ce719188b678dbbc8b078c0daa6/href</a></iframe><p>This tells the compiler several things:</p><ul><li>This file contains typings for the <strong>@google-cloud/pubsub</strong> library</li><li>The typings may be used outside of a Kotlin/JS module setting</li><li>The items described should have a Kotlin namespace of <strong>google.cloud.pubsub</strong></li></ul><p>Our types will use JavaScript <strong>Promise&lt;&gt;</strong> objects, so we also need to import those typings:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f65f839e712e98abfedfa21dbd52e35/href">https://medium.com/media/6f65f839e712e98abfedfa21dbd52e35/href</a></iframe><p>Finally, the actual typings. You can find <a href="https://github.com/feywind/kotlinjs-pubsub">the full example here</a>, but for example, for the PubSub class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ae275b27c84ded708b89c2e4bc607dd/href">https://medium.com/media/7ae275b27c84ded708b89c2e4bc607dd/href</a></iframe><p>I also like to make a Kotlin-idiomatic data class for JSON blobs we’d normally pass in. These can’t be in the same file — you must make a separate non-external file for that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/210f3cfd41575d7697716db285d220db/href">https://medium.com/media/210f3cfd41575d7697716db285d220db/href</a></iframe><p>In JavaScript, this will turn into a standard <strong>{ projectId: null, apiEndpoint: null }</strong> object.</p><h3>Interfacing with Pub/Sub</h3><p>We can now call the Node.js Pub/Sub library in a more or less normal way. This example uses the emulator:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f89e3e264979a65df15eb7356f80defc/href">https://medium.com/media/f89e3e264979a65df15eb7356f80defc/href</a></iframe><p>This is pretty nice! The <strong>subClient.on()</strong> call has turned into a Kotlin operator like “use”.</p><h3>Kotlin/JS and Coroutines</h3><p>Let’s take a look at another operation that might be common:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95fbbb9f60d74290a1178193f364233f/href">https://medium.com/media/95fbbb9f60d74290a1178193f364233f/href</a></iframe><p>Unfortunately, this returns a <strong>Promise&lt;&gt;</strong>, not the value we want. You can interface with this in the normal JavaScript way:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2be628a33906b2a69d6418e7c5a63c2/href">https://medium.com/media/d2be628a33906b2a69d6418e7c5a63c2/href</a></iframe><p>And again, this looks pretty good thanks to the Kotlin lambda parameter syntax. But we can do better.</p><p>In TypeScript, you’d simply use <strong>async</strong> and <strong>await</strong>. Kotlin/JS doesn’t currently support JavaScript native <strong>async</strong> and <strong>await</strong>. It does, however, provide Kotlin coroutines! And it turns out that <a href="https://discuss.kotlinlang.org/t/async-await-on-the-client-javascript/2412">it’s not too hard to bridge the two</a>. That discussion is from a while ago, and coroutines have since come out of the experimental phase, so it requires a little bit of work to bring it up to date.</p><p>First, we need an adapter between JavaScript <strong>Promise&lt;&gt;</strong> and Kotlin coroutines. This extension function will let you call <strong>.await()</strong> on any <strong>Promise&lt;&gt;</strong>, and the call becomes a <strong>suspend</strong> function call:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/585ace59786c574dc828f560d543b05f/href">https://medium.com/media/585ace59786c574dc828f560d543b05f/href</a></iframe><p>And since Kotlin/JS isn’t running on the JVM, we can’t use JVM-native operations like <a href="https://kotlinlang.org/docs/coroutines-basics.html#bridging-blocking-and-non-blocking-worlds">runBlocking</a>. So this implements a bridge from non-<strong>suspend</strong> code to a <strong>suspend</strong> function, kind of like calling an <strong>async</strong> function in JavaScript without <strong>await</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94b1a383f1dc369d8655fe019dbcc4b2/href">https://medium.com/media/94b1a383f1dc369d8655fe019dbcc4b2/href</a></iframe><p>And now we can do this sort of thing:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/241a2272179d068b2cd084a97048cded/href">https://medium.com/media/241a2272179d068b2cd084a97048cded/href</a></iframe><p>Hey, that’s looking pretty good, actually! We’re back to the ease of use of TypeScript <strong>async</strong> and <strong>await</strong>, but we are also writing Kotlin. This will transpile down gracefully into an application you can run on Node.js with no JVM.</p><h3>Next steps</h3><p>Check out a <a href="https://github.com/feywind/kotlinjs-pubsub">full working example that runs on the Pub/Sub emulator</a>.</p><p>Have you used Kotlin/JS on the server side with Node.js? Do you find this interesting and wish to hear more? Please feel free to leave a comment about this post or things that you find interesting/promising in regards to Kotlin and Kotlin/JS on Google Cloud Platform!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46ad79739bbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/using-cloud-pub-sub-on-node-js-from-kotlin-js-46ad79739bbf">Using Cloud Pub/Sub on Node.js from Kotlin/JS</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Cloud Pub/Sub from Kotlin]]></title>
            <link>https://medium.com/google-cloud/using-cloud-pub-sub-from-kotlin-d501f7d65e24?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d501f7d65e24</guid>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[cloud-pubsub]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[google-pubsub]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Tue, 30 Mar 2021 16:30:54 GMT</pubDate>
            <atom:updated>2021-03-30T21:13:09.821Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Kotlin logo" src="https://cdn-images-1.medium.com/max/174/0*XRk7MwMn9TycGfnL" /></figure><figure><img alt="Cloud Pub/Sub logo" src="https://cdn-images-1.medium.com/max/335/0*IMpDYU04xDIy2jTq" /></figure><h3>Why Kotlin on the server side?</h3><p>In regards to Google products, <a href="https://kotlinlang.org/">Kotlin</a> seems most well known as a language to build Android applications. But Kotlin’s lovely type safety and code brevity features work great on the server side, as well. And since it compiles and runs natively on the JVM, it is pretty easy to slot it into any place where you’d run a Java application.</p><p>Thankfully, it is also quite easy to use <a href="https://github.com/googleapis/java-pubsub">the existing Pub/Sub libraries written for Java</a>.</p><p><em>(Please note that this is not officially supported at this time, but hopefully this will get you going if you’re trying it!)</em></p><h3>Project setup</h3><p>It’s possible to create Kotlin projects that build using both Maven and Gradle, but Gradle is the preferred and “native” choice for Kotlin, so I will proceed with that.</p><p>The first step is to use either <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a> or <a href="https://developer.android.com/studio">Android Studio</a> to create a Kotlin command line project that builds with Gradle. Make sure to make a Console Application, and to set a JDK. (It doesn’t have to be 11.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IjrEfgE0F_XGCmDw" /></figure><p>There’s not much to change on the second page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I0SipFG9_r3bnKQ5" /></figure><p>To work with the Pub/Sub libraries, we must add them to our Gradle build configuration. Edit the <strong>build.gradle.kts</strong> file, and add the following <strong>implementation</strong> line:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e255b9b701564a6ef2e85d4f71e64b96/href">https://medium.com/media/e255b9b701564a6ef2e85d4f71e64b96/href</a></iframe><p>Of course, that is the current version as of this article; you should probably visit <a href="https://mvnrepository.com/artifact/com.google.cloud/google-cloud-pubsub">the Maven Central entry for the Pub/Sub library</a> and check for the latest version.</p><p><em>(If you have Gradle build errors, be aware that a recent IntelliJ update caused some of those; make sure you’re on 2020.3.1+.)</em></p><p>You should now be able to make calls to the Java Pub/Sub library, like this one:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8d940fbba28bb3bc37b2968979c5a1f/href">https://medium.com/media/c8d940fbba28bb3bc37b2968979c5a1f/href</a></iframe><p>Compilation should succeed, though it won’t do much just yet!</p><h3>Interfacing with Pub/Sub</h3><p>Now that your basic project is in place, you can use <a href="https://github.com/googleapis/java-pubsub">the Java APIs</a> but with the brevity and type safety in Kotlin that we know and love. For example, this function will begin listening on a subscription, calling the message receiver for each message received, until an exception happens.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/289507cb9616ad63b133699e5a40806f/href">https://medium.com/media/289507cb9616ad63b133699e5a40806f/href</a></iframe><p>You could use that function in something like this sample, which will simply receive and ack messages, and occasionally (once per 10 seconds) print a count of how many have been received:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33605701a28b2349d0a7ffd2441a3b9b/href">https://medium.com/media/33605701a28b2349d0a7ffd2441a3b9b/href</a></iframe><h3>Next steps</h3><p>From here, you can start to do things like creating fluent data classes for your message schema. The examples I gave above are also pretty simplistic, and maybe not quite idiomatic (apologies for being a bit rusty!) They could probably be improved using Kotlin flow operators and such. Kotlin continuations might also be used very gracefully to handle async communication.</p><p>See <a href="https://github.com/feywind/kotlin-pubsub">a complete example</a> which runs on a local emulator.</p><p>Have you used Kotlin on the server side? Please feel free to leave a comment about this post or things that you find interesting/promising in regards to Kotlin on Google Cloud Platform!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d501f7d65e24" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/using-cloud-pub-sub-from-kotlin-d501f7d65e24">Using Cloud Pub/Sub from Kotlin</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things I wish I knew about Google Cloud Pub/Sub]]></title>
            <link>https://medium.com/google-cloud/things-i-wish-i-knew-about-google-cloud-pub-sub-852fac1ffbc6?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/852fac1ffbc6</guid>
            <category><![CDATA[google-cloud-pubsub]]></category>
            <category><![CDATA[google-pubsub]]></category>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 15:08:09 GMT</pubDate>
            <atom:updated>2021-06-09T17:27:54.770Z</atom:updated>
            <content:encoded><![CDATA[<h3>Things I wish I knew about Google Cloud Pub/Sub: Part 1</h3><p>Pub/Sub can seem like a simple topic, but there is actually a fair amount of subtlety to consider. It’s possible to overlook details that might make your experience more streamlined, less expensive, and less frustrating. To that end, the Developer Relations team for the Google Cloud Pub/Sub client libraries are starting a blog series with some information and tips you might find useful.</p><p>And without further ado…!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*aryNpjtAU4mkKF-LXzCM6Q.png" /></figure><h3>What is Google Cloud Pub/Sub?</h3><h4>Google Cloud Pub/Sub is a managed, globally available messaging service that scales automatically with demand.</h4><p>To understand the service in its most basic terms, familiarize yourself with four key components: topics, subscriptions, publisher clients, and subscriber clients.</p><ul><li>Pub/Sub clients publish messages to<strong> topics</strong>.</li><li>Pub/Sub clients receive messages from <strong>subscriptions</strong>. You can create multiple subscriptions for the same topic, in which case each subscription gets a copy of all of the messages in the topic. Some beginners assume that one would pull messages from a <strong>topic</strong>, which isn’t possible — <strong>topics</strong> are for publishing only. The <strong>subscription</strong> is where you will receive all messages.</li><li>Your application can create multiple <strong>Pub/Sub clients</strong> to publish to a topic, across different processes. (With some caveats mentioned below.)</li><li>Your application can also create multiple <strong>subscriber clients</strong> for a single subscription, in which case message delivery is load balanced across all of them. Messages are delivered to one client on the <strong>subscription</strong>, not all of them.</li></ul><h3>How do I call Pub/Sub APIs?</h3><h4>You can use Pub/Sub through both the<a href="http://console.cloud.google.com"> Google Cloud Console</a> and the<a href="https://cloud.google.com/sdk"> Cloud SDK</a>, and the<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries"> official client libraries</a>. The most common way to access Pub/Sub APIs is through the client libraries, available in 8 languages (<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#cpp">C++</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#c"> C#</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#pubsub-client-libraries-go"> Go</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#java"> Java</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#node.js"> Node</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#php"> PHP</a>,<a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#pubsub-client-libraries-python"> Python</a>, <a href="https://cloud.google.com/pubsub/docs/quickstart-client-libraries#ruby">Ruby</a>).</h4><p>These libraries provide language-idiomatic ways to create topics, publish messages to topics, create subscriptions to topics, and receive messages from subscriptions. These clients are handwritten and built on top of<a href="https://github.com/googleapis/java-pubsub/tree/master/proto-google-cloud-pubsub-v1/src/main"> auto-generated libraries</a>, which expose the basic RPC methods available from the Pub/Sub server. This allows us to add useful features centered around improving throughput, minimizing latency, and making it easier to handle incoming messages.</p><p>Because the libraries cache information like authentication tokens, we recommend instantiating only one instance of a Pub/Sub client per resource within one process, instead of creating multiple clients. This varies by language; for example, Java uses separate client classes, while Node has a PubSub class that should be created per process, per Pub/Sub server connection; that is then used to create clients for publishing and subscription.</p><p>In Node, it might look something like this:</p><pre>let pubSubClient, topic;</pre><pre>async function main() {<br>  pubSubClient = new PubSub();<br>  topic = pubSubClient.topic(‘myTopic’);<br>  topic.publish(Buffer.from(‘test!’));<br>  await doOtherWork();<br>}</pre><pre>async function doOtherWork() {<br>  // ...<br>  topic.publish(Buffer.from(‘also test!’));<br>  // ...<br>}</pre><pre>main().catch(console.error);</pre><p>Each library has a more fully featured Quickstart, for a more comprehensive sample; for example, the <a href="https://github.com/googleapis/nodejs-pubsub#quickstart">Node Quickstart</a>.</p><p>If you would like greater control over features not available in our client libraries, you can build your own client library using the auto-generated libraries, <a href="https://cloud.google.com/pubsub/docs/reference/rest">REST</a>, or <a href="https://cloud.google.com/pubsub/docs/reference/rpc">RPC</a> stubs. However, we strongly recommend that you look for a way that is supported natively by the client library. If you can’t find one, please add a bug report to the respective library on GitHub or <a href="https://issuetracker.google.com/issues?q=componentid:187173">Buganizer</a>.</p><h3>More to come</h3><p>Thank you for reading, and please look forward to future posts (Part <a href="https://medium.com/google-cloud/things-i-wish-i-knew-about-google-cloud-pub-sub-part-2-b037f1f08318">2</a>, <a href="https://medium.com/google-cloud/things-i-wish-i-knew-about-pub-sub-part-3-b8947b49224b">3</a>) from the Pub/Sub Developer Relations team that will help your Pub/Sub usage become even easier! We would also love to hear from you about topics that you’d like discussed, or if you have any comments on the post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=852fac1ffbc6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/things-i-wish-i-knew-about-google-cloud-pub-sub-852fac1ffbc6">Things I wish I knew about Google Cloud Pub/Sub</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[console.log(‘hello world’);]]></title>
            <link>https://feywind.medium.com/console-log-hello-world-48daff4c149e?source=rss-cf0009f94ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/48daff4c149e</guid>
            <category><![CDATA[intro]]></category>
            <dc:creator><![CDATA[Megan Potter]]></dc:creator>
            <pubDate>Tue, 27 Oct 2020 14:03:13 GMT</pubDate>
            <atom:updated>2020-10-27T14:03:13.386Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, I’d like to give a short introduction as I join Medium, writing mostly in relation to Google Cloud Platform.</p><p>I started at Google, in Developer Relations, in October 2019, with a focus on the Pub/Sub client libraries under Node.js. My focus has expanded over time to include the general Node.js ecosystem within GCP Developer Relations, as well as our GitHub automation tooling.</p><p>In a more general sense, I’ve been in the industry for quite a while, working across many different languages and libraries, such as C++, C#, Java, Kotlin, and even a few variants of assembly language. I’m especially interested in game development, but that’s a very occasional hobby. My time with Node.js and TypeScript started somewhere around 2016, working with the Predix platform at GE Aviation.</p><p>Outside of work, I have many hobbies! Drawing art, making music, sometimes writing fiction. In more normal times, I also love to hike in the mountains, and I’ve taken a few blissful flights on a hang glider. (That’s a hobby I’d love to be more involved with, but the opportunity hasn’t been available lately.) You might also guess, from my avatar, that I’m a fan of Final Fantasy XIV.</p><p>In the coming months, I’m hoping to present you all with some blog posts about Pub/Sub in Google Cloud Platform. I’m looking forward to it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48daff4c149e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>