abhilashmandaliya commented on a change in pull request #11728:
URL: https://github.com/apache/pulsar/pull/11728#discussion_r693304194
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java
##########
@@ -93,6 +98,19 @@ private MessageRouter getMessageRouter() {
switch (messageRouteMode) {
case CustomPartition:
+ String messageRouterClassName =
conf.getMessageRouterClassName();
+ if (isNotBlank(messageRouterClassName)) {
+ Class<?> clazz;
+ try {
+ clazz = Class.forName(messageRouterClassName);
+ messageRouter = (MessageRouter)
clazz.getDeclaredConstructor().newInstance();
+ conf.setCustomMessageRouter(messageRouter);
+ } catch (ClassNotFoundException | NoSuchMethodException |
InvocationTargetException |
+ InstantiationException | IllegalAccessException |
ClassCastException e) {
+ log.error("[{}] Error occurred while instantiating the
messageRouterClassName",
+ messageRouterClassName, new
PulsarClientException(e));
+ }
Review comment:
ok. then something like this should work I guess:
```java
log.error("[{}] Error occurred while instantiating the
messageRouterFactoryClassName", messageRouterFactoryClassName);
throw new RuntimeException(e);
```
RuntimeException looks a little odd, but I can see that at many places, we
have taken this approach.
@lhotari you also had suggestions on exceptions so please have a look here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]