File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
pulsar-broker/src/main/java/org/apache/pulsar/broker/rest Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 6363import org .apache .pulsar .broker .lookup .LookupResult ;
6464import org .apache .pulsar .broker .namespace .LookupOptions ;
6565import org .apache .pulsar .broker .service .BrokerServiceException ;
66+ import org .apache .pulsar .broker .service .Topic ;
6667import org .apache .pulsar .broker .service .schema .SchemaRegistry ;
6768import org .apache .pulsar .broker .service .schema .exceptions .SchemaException ;
6869import org .apache .pulsar .broker .web .RestException ;
@@ -282,8 +283,14 @@ private CompletableFuture<Position> publishSingleMessageToPartition(String topic
282283 .remove (topicName .getPartitionIndex ());
283284 } else {
284285 try {
285- t .get ().publishMessage (messageToByteBuf (message ),
286- RestMessagePublishContext .get (publishResult , t .get (), System .nanoTime ()));
286+ ByteBuf headersAndPayload = messageToByteBuf (message );
287+ try {
288+ Topic topicObj = t .get ();
289+ topicObj .publishMessage (headersAndPayload ,
290+ RestMessagePublishContext .get (publishResult , topicObj , System .nanoTime ()));
291+ } finally {
292+ headersAndPayload .release ();
293+ }
287294 } catch (Exception e ) {
288295 if (log .isDebugEnabled ()) {
289296 log .debug ("Fail to publish single messages to topic {}: {} " ,
You can’t perform that action at this time.
0 commit comments