You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/22 07:25:09 UTC
[GitHub] [pulsar] rdhabalia opened a new pull request #11743: [pulsar-client] Fix: set and return topic name on message api
rdhabalia opened a new pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743
### Motivation
In an application that has multiple topics and shares a single MessageRouter across all the topics then it's not possible right now, to find out the topic name in message-router when `MessageRouter::choosePartition` receives callback and application which requires topic-name to derive partition-number can not work.
### Modification
Set and return Topic-name in `Message::getTopicName()` API.
### Result
The application that requires topic name while selecting partition in MessageRouter, will be able to successfully get topic name and return the correct partition based on it,
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] rdhabalia merged pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
rdhabalia merged pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#issuecomment-905210418
I agree with @rdhabalia
@Demogorgon314 do you want to send a PR for the new MessageBuilder API ?
IIUC we have to write up a small PIP for it, as it is a new API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] rdhabalia commented on pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#issuecomment-905130791
> We should find a way to build a MessageImpl in KOP without using TypedMessageBuilderImpl.
> if we need a MessageImpl then we need a public API to create an instance of a Message without using a Producer
Yes, `Message` creation should not depend on `Producer`. iirc, it was there in V1 API but it has changed with the v2 API. I guess, one of the solutions is to provide API to create MessageBuilder from `Message` which can be used by applications to create messages independently.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Demogorgon314 commented on pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
Demogorgon314 commented on pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#issuecomment-905290647
> I agree with @rdhabalia
>
> @Demogorgon314 do you want to send a PR for the new MessageBuilder API ?
> IIUC we have to write up a small PIP for it, as it is a new API
Agree. I'll send a PR, but we need write a small PIP first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] rdhabalia commented on a change in pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on a change in pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#discussion_r695343483
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java
##########
@@ -78,13 +78,14 @@
private boolean poolMessage;
// Constructor for out-going message
- public static <T> MessageImpl<T> create(MessageMetadata msgMetadata, ByteBuffer payload, Schema<T> schema) {
Review comment:
`MessageImpl` is implementation class and it should not be used as a contract.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on a change in pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#discussion_r694825749
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/TypedMessageBuilderImpl.java
##########
@@ -284,7 +284,7 @@ public MessageMetadata getMetadataBuilder() {
public Message<T> getMessage() {
beforeSend();
- return MessageImpl.create(msgMetadata, content, schema);
+ return MessageImpl.create(msgMetadata, content, schema, producer.topic);
Review comment:
@Demogorgon314 I would use producer.getTopic() in order to ease mocking.
also the producer field used to be `nullable`
this change is the cause of https://github.com/streamnative/kop/issues/677
I am not sure that the KOP usage is correct, as it is using an internal API to build a message
if we change to producer.getTopic(), will you be able to fix the KOP issue ?
isn't there any other way of creating a Message without using the Builder ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Demogorgon314 commented on a change in pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
Demogorgon314 commented on a change in pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#discussion_r694813316
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/TypedMessageBuilderImpl.java
##########
@@ -284,7 +284,7 @@ public MessageMetadata getMetadataBuilder() {
public Message<T> getMessage() {
beforeSend();
- return MessageImpl.create(msgMetadata, content, schema);
+ return MessageImpl.create(msgMetadata, content, schema, producer.topic);
Review comment:
Why do we use `producer.topic` instead of `producer.getTopic()` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Demogorgon314 commented on a change in pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
Demogorgon314 commented on a change in pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#discussion_r694913211
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/TypedMessageBuilderImpl.java
##########
@@ -284,7 +284,7 @@ public MessageMetadata getMetadataBuilder() {
public Message<T> getMessage() {
beforeSend();
- return MessageImpl.create(msgMetadata, content, schema);
+ return MessageImpl.create(msgMetadata, content, schema, producer.topic);
Review comment:
If we change to `producer.getTopic()`, we are still unable fix the KoP issue, maybe we shouldn't use the `TypedMessageBuilderImpl` in KoP, we can construct `MessageImpl` manually or we can determine whether `producer ` is null or not in `TypedMessageBuilderImpl#getMessage()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#issuecomment-904776967
adding a null check for "producer" here smells a little, because this (the internals of TypedMessageBuilderImpl) is not a Public API, it is internal and here "producer" is always not null.
We should find a way to build a MessageImpl in KOP without using TypedMessageBuilderImpl.
if we need a MessageImpl then we need a public API to create an instance of a Message without using a Producer
cc @merlimat @rdhabalia
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Demogorgon314 commented on a change in pull request #11743: [pulsar-client] Fix: set and return topic name on message api
Posted by GitBox <gi...@apache.org>.
Demogorgon314 commented on a change in pull request #11743:
URL: https://github.com/apache/pulsar/pull/11743#discussion_r695335552
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java
##########
@@ -78,13 +78,14 @@
private boolean poolMessage;
// Constructor for out-going message
- public static <T> MessageImpl<T> create(MessageMetadata msgMetadata, ByteBuffer payload, Schema<T> schema) {
Review comment:
We should not modify this method, maybe it is better to add a new one, and MoP depends on this method.
https://github.com/streamnative/mop/blob/master/mqtt-impl/src/main/java/io/streamnative/pulsar/handlers/mqtt/utils/PulsarMessageConverter.java#L66
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org