<?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 Sijie Guo on Medium]]></title>
        <description><![CDATA[Stories by Sijie Guo on Medium]]></description>
        <link>https://medium.com/@sijieg?source=rss-2185f80185da------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*clEy2owo8uYJo3qB.jpg</url>
            <title>Stories by Sijie Guo on Medium</title>
            <link>https://medium.com/@sijieg?source=rss-2185f80185da------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:27:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sijieg/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[What’s New in Apache Pulsar 2.4.0]]></title>
            <link>https://medium.com/streamnative/whats-new-in-apache-pulsar-2-4-0-d646f6727642?source=rss-2185f80185da------2</link>
            <guid isPermaLink="false">https://medium.com/p/d646f6727642</guid>
            <category><![CDATA[schemaregistry]]></category>
            <category><![CDATA[tech-blog]]></category>
            <category><![CDATA[event-streaming]]></category>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[apache-pulsar]]></category>
            <dc:creator><![CDATA[Sijie Guo]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 15:38:36 GMT</pubDate>
            <atom:updated>2019-11-07T02:41:57.880Z</atom:updated>
            <content:encoded><![CDATA[<p>We are very glad to see the Apache Pulsar community has successfully released the wonderful 2.4.0 release after a few months of accumulated hard works. It is a great milestone for this fast-growing project and the whole Pulsar community. Here is a selection of some of the most interesting and important features the community added to this new release.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*bZB0bQQ0vx7WohdhB5RWMQ.png" /></figure><h3>Core Pulsar</h3><h4>PIP-26: Delayed or scheduled message delivery</h4><p>Delayed message delivery and scheduled message delivery are commonly seen in the traditional messaging systems. A producer can specify a message to be delivered after a given delayed duration or at a scheduled time. The message is only dispatched to a consumer after time criteria is fully satisfied.</p><p>Pulsar introduces these two functionalities in 2.4.0 for the consumers of *shared* subscriptions. The following two examples demonstrate how to use these two features.</p><p><strong>Example of delayed message delivery</strong></p><p>The following example shows how to deliver messages after 3 minutes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66340e45f905f37e96e0b9d1d8581928/href">https://medium.com/media/66340e45f905f37e96e0b9d1d8581928/href</a></iframe><p><strong>Example of scheduled message delivery</strong></p><p>The following example shows how to deliver messages at 11 pm on 06/27/2019.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8be253cb774dd6e7c91fc3f5007be7a9/href">https://medium.com/media/8be253cb774dd6e7c91fc3f5007be7a9/href</a></iframe><blockquote>Note that the messages sent by <strong>deliverAfter </strong>or <strong>deliverAt </strong>will not be batched even batching is enabled at a producer side.</blockquote><p>Pulsar broker uses a <strong>DelayedDeliveryTracker</strong> for tracking the delayed delivery of messages for a particular subscription. The current <strong>DelayedDeliveryTracker</strong> holds the delayed messages in an in-memory priority queue. So you have to plan for the memory usage when enabling the delayed delivery feature. A persistent hash-wheel based implementation was discussed in the community and is planned to add in the future to support a wider range of delay durations.</p><p>To learn more about the design of delayed message delivery, see <a href="https://github.com/apache/pulsar/wiki/PIP-26:-Delayed-Message-Delivery">PIP-26</a>.</p><h4>PIP-34: Key_Shared subscription</h4><p>Prior to 2.4.0 release, Pulsar only supports 3 subscription modes, <strong>Exclusive</strong>, <strong>Failover</strong> and <strong>Shared</strong>. Both Exclusive and Failover subscription modes are <strong>streaming </strong>subscription modes. In such modes, a Pulsar partition can only be assigned to one consumer of the subscription to consume and the messages are dispatched in <strong>partition</strong> order. In contrast, the Shared subscription mode dispatches the messages of a single partition to multiple consumers in a round-robin fashion. Shared subscription is also known as <strong>queuing</strong> (or worker-queue) subscription mode.</p><p>In Exclusive and Failover subscriptions, the ordering of the messages is guaranteed on per partitions basis. However, the parallelism of the consumption is limited by the number of partitions of the topic. In contrast, the consumption parallelism of a Shared subscription can go beyond the number of partitions, but it doesn’t have any ordering guarantees.</p><p>In a lot of use cases such as change data capture (aka CDC) for distributed databases, applications require both the scalability of Shared subscription to increase the number of consumers for high throughput and the ordering guarantees provided in Exclusive or Failover subscription. Key_Shared subscription is introduced in 2.4.0 to meet this requirement.</p><p>In Key_Shared subscription, there can be more consumers than partitions. And the messages of the same key are routed to one consumer of the subscription.</p><p>The following example shows how to use Key_Shared subscription.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51ef3334d287a2fff8663a0186c2cf05/href">https://medium.com/media/51ef3334d287a2fff8663a0186c2cf05/href</a></iframe><p>If you are interested in learning the design details of Key_Shared<strong> </strong>subscription, see <a href="https://github.com/apache/pulsar/wiki/PIP-34:-Add-new-subscribe-type-Key_shared">PIP-34</a>.</p><p>There are more cool features about Key_Shared subscription planned for 2.5.0 release. If you are interested in this feature or would like to contribute to it, you can follow the GitHub issue <a href="https://github.com/apache/pulsar/issues/4077">#4077</a> and discuss your ideas with Pulsar committers.</p><h4>PIP-36: Configure max message size at broker side</h4><p>Previously, Pulsar limits the max message size (aka <strong>MaxMessageSize</strong>) to <strong>5 MB</strong>. This setting was hardcoded at Pulsar encoder and decoder. Administrators cannot adjust this setting by modifying the broker configuration. But in some use cases, for example, when capturing change events from databases, a change event might be larger than 5 MB. These change events cannot be produced to Pulsar successfully.</p><p>Pulsar introduces a setting at broker configuration in 2.4.0 release. This setting allows administrators to configure a different value for the max message size. Additionally, Pulsar introduces a new field <strong>max_message_size</strong> in the <strong>CommandConnected</strong> response that brokers send back to clients when they connect. Then Pulsar clients are able to learn the <strong>MaxMessageSize</strong> that each broker supports and configure the batching buffer accordingly.</p><p><strong>You need 2.4.0 release for both brokers and clients to leverage this feature.</strong></p><p>Note that although Pulsar allows configuring max message size, it doesn’t mean it is recommended to configure the setting to an arbitrary large value. Because a very large max message size hurts IO and resource efficiency. There are also multiple PIPs tackling supporting arbitrary large sized messages by chunking the large messages into smaller chunked messages. These PIPs are:</p><ul><li><a href="https://github.com/apache/pulsar/wiki/PIP-37%3A-Large-message-size-handling-in-Pulsar">PIP-37: Large message size handling in Pulsar</a>: <a href="https://github.com/apache/pulsar/pull/4400">#4400</a></li><li><a href="https://github.com/apache/pulsar/wiki/PIP-31%3A-Transaction-Support">PIP-31: Transactional Streaming</a>: <a href="https://github.com/apache/pulsar/issues/2664">#2664</a></li></ul><p>You can follow the GitHub issue, subscribe the Pulsar mailing lists or join the <a href="https://apache-pulsar.herokuapp.com/">Pulsar slack channels</a> to receive development updates about these features.</p><h4>PIP-33: Replicated subscription</h4><p>Geo-replication is one of the best features that Pulsar provides outperforming other messaging or streaming systems in the market. In a geo-replicated Pulsar instance, a topic can be configured to be replicated across multiple regions (for example, us-west, us-east, and eu-central). The topic is presented as a virtual <strong>global </strong>entity in which messages can be published and consumed from any of the configured clusters.</p><p>However, the only limitation is that subscriptions are currently <strong>local</strong> to the cluster in which they are created. That means the subscription state is <strong>NOT</strong> replicated across regions. If a consumer reconnects to a new region, it triggers the creation of a new unrelated subscription, albeit with the same name. The subscription will be created at the tail of the topic in the new region (or at the beginning, depending on its <strong>SubscriptionInitialPosition</strong> configuration) and at the same time, the original subscription will be left dangling in the previous region.</p><p>Pulsar introduces <strong>Replicated Subscription</strong> in 2.4.0. It added a mechanism to keep subscription state in-sync between multiple geo-replicated regions, within a sub-second framework.</p><p>You can configure your consumer to enable replicated subscription by setting <strong>replicateSubscriptionState</strong> to be <strong>true</strong>. The code example is shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/120872548228139e90ebd43c1a6bdbcf/href">https://medium.com/media/120872548228139e90ebd43c1a6bdbcf/href</a></iframe><p>If you are interested in learning the design details about <strong>replicated subscription</strong>, see <a href="https://github.com/apache/pulsar/wiki/PIP-33:-Replicated-subscriptions">PIP-33</a>.</p><h3>Security</h3><h4>PIP-30: Mutual authentication and Kerberos support</h4><p>Pulsar supports pluggable authentication mechanisms, such as <a href="https://pulsar.apache.org/docs/en/security-tls-authentication/">TLS Authentication</a>, <a href="https://pulsar.apache.org/docs/en/security-athenz/">Athenz</a> and <a href="https://pulsar.apache.org/docs/en/security-token-client/">JSON Web Tokens</a>. However, all the provided authentication mechanisms are one-step authentication. The current authentication abstraction is not able to support mutual authentication between client and server, such as <a href="https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer">SASL</a>. <a href="https://github.com/apache/pulsar/wiki/PIP-30%3A-change-authentication-provider-API-to-support-mutual-authentication">PIP-30</a> changes the interface to support mutual authentication. The <a href="https://pulsar.apache.org/docs/en/security-kerberos/">Kerberos Authentication</a> was implemented using the newly changed authentication interfaces.</p><p>If you are interested in learning the implementation details, see <a href="https://github.com/apache/pulsar/wiki/PIP-30%3A-change-authentication-provider-API-to-support-mutual-authentication">PIP-30</a>. If you are interested in trying the Kerberos authentication, follow the instructions documented at <a href="https://pulsar.apache.org/docs/en/security-kerberos/">Pulsar website</a>.</p><h3>Pulsar Functions</h3><h4>Go Functions</h4><p>Prior to 2.4.0, users can only write Pulsar functions using Java or Python. In 2.4.0, Pulsar starts supporting writing Pulsar functions using the popular <a href="https://golang.org/">Golang</a>.</p><p>The exclamation example of Pulsar Functions written in Golang is shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f9757c9ac18e08aa3657bd2ce288e62/href">https://medium.com/media/8f9757c9ac18e08aa3657bd2ce288e62/href</a></iframe><p>Go Function support in 2.4.0 is an MVP (minimum viable product). There are more features planned in 2.5.0 for Go Function to align with the features available in Java/Python Function.</p><p>If you are interested in learning the implementation details of Go Function, see <a href="https://github.com/apache/pulsar/wiki/PIP-32%3A-Go-Function-API%2C-Instance-and-LocalRun">PIP-32</a>. If you are interested in contributing to Go Function, follow the Github issue <a href="https://github.com/apache/pulsar/issues/3767">#3767</a> and discuss your ideas with Pulsar committers.</p><h3>Schema</h3><p>Pulsar introduced native schema support and provided a built-in schema registry since 2.0.0 release. After a few successful releases, Pulsar Schema has become more and more mature. Especially in 2.4.0, there are a lot of changes happen around Pulsar Schema. Here are a few highlights for them.</p><h4>Schema versioning</h4><p>Prior to 2.4.0, Pulsar clients only use the latest version of schema or the provided schema for encoding and decoding Pulsar messages. Hence it didn’t handle well on encoding and decoding Pulsar messages with schema evolution.</p><p>Issue <a href="https://github.com/apache/pulsar/pull/4646">#4646</a> introduced versioned schema reader to deserialize Pulsar messages using the correct version of the schema and handle the schema evolution properly.</p><h4>Transitive compatibility check strategies</h4><p>Prior to 2.4.0, Pulsar Schema only supported <strong>ALWAYS_COMPATIBLE</strong>, <strong>ALWAYS_INCOMPATIBLE</strong>, <strong>BACKWARD</strong>, <strong>FORWARD</strong> and <strong>FULL</strong> compatibility check strategies. BACKWARD, FORWARD and FULL strategies only check the new schema with the last schema. However, it is not enough. Issue <a href="https://github.com/apache/pulsar/issues/4170">#4170</a> introduced three <strong>transitive </strong>check strategies to check the compatibility with all existing schemas. These transitive strategies are:</p><ul><li><strong>BACKWARD_TRANSITIVE</strong>: Consumers using the new schema can read messages produced by all previous schemas, not just the last schema. For example, if there are three schemas for a topic that change in order V1, V2, and V3, then BACKWARD_TRANSITIVE compatibility ensures that consumers using the new schema V3 can process data written by the producers using the schema V3, V2, or V1.</li><li><strong>FORWARD_TRANSITIVE</strong>: The messages produced with a new schema can be read by consumers using all previously registered schemas, not just the last schema. For example, if there are three schemas for a topic that change in order V1, V2, and V3, then FORWARD_TRANSTIVE compatibility ensures that data written by the producers using the new schema V3 can be processed by the consumers using the schema V3, V2, or V1.</li><li><strong>FULL_TRANSITIVE</strong>: The new schema is forward and backward compatible with all previously registered schemas, not just the last one. For example, if there are three schemas for a topic that change in order V1, V2, and V3, then FULL_TRANSITIVE compatibility ensures that the consumers using the new schema V3 can process data written by the producers using the schema V3, V2, and V1, and data written by the producers using the new schema V3 can be processed by the consumers using the schema V3, V2, and V1.</li></ul><p>The completed list of compatibility check strategies is shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cf2fbcf88b538b6e4f54ffc064a2bc6/href">https://medium.com/media/2cf2fbcf88b538b6e4f54ffc064a2bc6/href</a></iframe><h4>GenericSchema and AutoConsume</h4><p>Prior to 2.4.0, Pulsar only supported constructing schemas using static POJOs. This is convenient for applications that can know the schema ahead of time. However, in some use cases (for example, CDC — change data capture), applications don’t know the schema ahead of time. In such use cases, there is no way for applications to declare the schema programmatically or dynamically. Pulsar resolves the problem by introducing <strong>GenericSchema</strong> and <strong>GenericRecord</strong> in 2.4.0.</p><p>You can declare a <strong>schema</strong> programmatically by using <strong>GenericSchemaBuilder</strong>. The code example of constructing a generic schema is shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eed9b8e77dd9a40436de597e319b2618/href">https://medium.com/media/eed9b8e77dd9a40436de597e319b2618/href</a></iframe><p>After you declared a generic schema, you can build the records programmatically. The code example of building a generic record is shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/52d9e4e32dc8e80bf78a26ad74503f4f/href">https://medium.com/media/52d9e4e32dc8e80bf78a26ad74503f4f/href</a></iframe><p>If you don’t know the schema of a topic, you can use <strong>AUTO_CONSUME</strong> to consume the topic into <strong>GenericRecord</strong>. The GenericRecord will provide the schema associated with this record. The example of using AUTO_CONSUME is shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4610ebc2c2f16fd06d473cd483589003/href">https://medium.com/media/4610ebc2c2f16fd06d473cd483589003/href</a></iframe><h4>KeyValue Schema</h4><p>KeyValue Schema was first introduced to Pulsar in 2.3.0 release. The first implementation of KeyValue schema encoded a key/value pair together into the payload of a message and it didn’t store key schema and value schema.</p><p>In 2.4.0, Pulsar stores both key and value schemas as the schema data in KeyValue schema, so Pulsar can handle the schema evaluation on both key and value. Additionally, Pulsar introduces a new encoding mode that encodes key into the key part of a message and value into the payload part of a message. This allows leverage Pulsar features related to message keys.</p><p>The example of constructing a key/value schema with <strong>SEPARATED</strong> encoding type is shown below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db764b620f36c48bd924ed5f0ee7a528/href">https://medium.com/media/db764b620f36c48bd924ed5f0ee7a528/href</a></iframe><h3>More information</h3><ul><li>Pulsar 2.4.0 release notes, click <a href="http://pulsar.apache.org/release-notes/#240-mdash-2019-06-30-a-id-240-a">here</a>.</li><li>If you are interested in Pulsar community news, Pulsar development details and Pulsar user stories on production, follow <a href="https://medium.com/streamnative">StreamNative Medium</a> or <a href="https://twitter.com/streamnativeio">@streamnativeio</a> on Twitter.</li><li>If you are interested in Pulsar examples, demos, tools and extensions, check out <a href="https://github.com/streamnative">StreamNative</a> on GitHub.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d646f6727642" width="1" height="1" alt=""><hr><p><a href="https://medium.com/streamnative/whats-new-in-apache-pulsar-2-4-0-d646f6727642">What’s New in Apache Pulsar 2.4.0</a> was originally published in <a href="https://medium.com/streamnative">StreamNative</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>