What’s new?

What’s New in 1.1 Since 1.0

此部分涵盖了从版本 1.0 到版本 1.1 的更改。

This section covers the changes made from version 1.0 to version 1.1.

Auto Schema support

如果不提前了解 Pulsar 主题模式,则可以使用 AUTO Schemas 将通用记录生成/使用到代理服务器。有关更多详细信息,请参阅 Producing with AUTO_SCHEMAConsuming with AUTO_SCHEMA

If there is no chance to know the schema of a Pulsar topic in advance, you can use AUTO Schemas to produce/consume generic records to/from brokers. See Producing with AUTO_SCHEMA and Consuming with AUTO_SCHEMA for more details.

尽管上述链接侧重于 PulsarTemplate@PulsarListener,此功能在 ReactivePulsarTemplate@ReactivePulsarListener@PulsarReader 中也受支持。详细信息可在各自的参考指南部分中找到。

While the above links focus on PulsarTemplate and @PulsarListener, this feature is also supported in ReactivePulsarTemplate, @ReactivePulsarListener, and @PulsarReader. Details for each can be found in their respective section of this reference guide.

Default topic/schema via message annotation

现在,可以使用 @PulsarMessage 标记消息类,以便指定在生成/使用该类型消息时使用的 default topic 和/或 default schema

You can now mark a message class with @PulsarMessage to specify the default topic and/or default schema to use when producing/consuming messages of that type.

Remove checked exceptions

框架提供的 API 不再抛出已检查的 PulsarClientException,而是抛出未检查的 PulsarException

The APIs provided by the framework no longer throw the checked PulsarClientException, but rather the unchecked PulsarException.

如果您之前仅捕获或重新抛出 PulsarClientException 以满足编译器要求,并且其实未处理异常,则可以简单地删除 catchthrows 子句。如果您确实处理了异常,则需要在您的 catch 子句中用 PulsarClientException 替换 PulsarException

If you were previously catching or rethrowing PulsarClientException just to appease the compiler and were not actually handling the exception, you can simply remove your catch or throws clause. If you were actually handling the exception then you will need to replace PulsarClientException with PulsarException in your catch clause.

Testing support

现在,可以使用 spring-pulsar-test 模块帮助测试 Spring 以获得 Apache Pulsar 应用程序。有关更多详细信息,请参阅 Testing Applications

The spring-pulsar-test module is now available to help test your Spring for Apache Pulsar applications. See Testing Applications for more details.