Comments (13)
There is no manipulation of the String value for the broker list; it is passed into Kafka as a property unchanged here. Perhaps you have some other version of your config with the comma on your classpath?
from spring-integration-kafka.
Thanks, and sorry, I'm not familiar with Spring Integration. I tried to use your examples and description from https://github.com/spring-projects/spring-integration-kafka. Like this
<int-kafka:message-driven-channel-adapter
id="adapter"
channel="output"
connection-factory="connectionFactory"
key-decoder="decoder"
payload-decoder="decoder"
offset-manager="offsetManager"
max-fetch="100"
topics="${kafka.test.topic}"/>
How to configure the broker list directly? https://github.com/rssdev10/flink-spring-integration/blob/master/drpc-client/src/main/resources/flink-integration-context.xml
BTW: what is the topics string format?
And regarding Kafka I nothing changed in they typical config.
from spring-integration-kafka.
Try to use BrokerAddressListConfiguration
instead of ZookeeperConfiguration
.
Also it is really isn't clear why your current solution fail with the strange resolution to the localhost,:9092
.
The code to consider ( ZookeeperConfiguration
):
zkClient = new ZkClient(this.zookeeperServers, this.sessionTimeout, this.connectionTimeout,
ZKStringSerializer$.MODULE$);
Seq<Broker> allBrokersInCluster = ZkUtils$.MODULE$.getAllBrokersInCluster(zkClient);
FastList<Broker> brokers = FastList.newList(JavaConversions.asJavaCollection(allBrokersInCluster));
return brokers.collect(brokerToBrokerAddressFunction);
and DefaultConnectionFactory
:
String brokerAddressesAsString = ListIterate
.collect(this.configuration.getBrokerAddresses(), Functions.getToString()).makeString(",");
from spring-integration-kafka.
@artembilan thanks, BrokerAddressConfiguration works.
<bean id="connectionFactory"
class="org.springframework.integration.kafka.core.DefaultConnectionFactory">
<!-- <constructor-arg ref="zookeeperConfiguration" /> -->
<constructor-arg ref="brokerConfig" />
</bean>
<bean id="brokerConfig"
class="org.springframework.integration.kafka.core.BrokerAddressListConfiguration">
<constructor-arg value="#{T(org.springframework.integration.kafka.core.BrokerAddress).fromAddress('localhost:9092')}" />
</bean>
But is it possible to configure one without such terrible SpEL?
from spring-integration-kafka.
Just make BrokerAddress
as inner bean!
<bean id="brokerConfig"
class="org.springframework.integration.kafka.core.BrokerAddressListConfiguration">
<constructor-arg>
<bean class="org.springframework.integration.kafka.core.BrokerAddress" factory-method="fromAddress">
<constructor-arg value="localhost:9092"/>
</bean>
</constructor-arg>
</bean>
But SpEL should be shorter.
From other side it would be great to understand who breaks localhost:9092
to the localhost,:9092
for you in case of ZookeeperConfiguration
...
Would you mind to debug your application with break points on the Spring Integration Kafka code, e.g. ZookeeperConfiguration.doGetBrokerAddresses()
will be a good candidate?
from spring-integration-kafka.
from spring-integration-kafka.
M-m-m. Any comments, please. I'm not familiar with Eclipse:
The screenshot from IDEA:
from spring-integration-kafka.
According to your screen it really shows that Zookeeper returns localhost,
as a host for your broker.
Not sure where that is broken, but right now it is out of our hands.
We can't control it on Spring Integration Kafka side.
from spring-integration-kafka.
Eclipse is not so hard :) . Left upper part contains a current state of variables and "localhost," is shown.
I guess the problem is somewhere in ZkUtils / getBrokerInfo(zkClient, _).
def getAllBrokersInCluster(zkClient: ZkClient): Seq[Broker] = {
val brokerIds = ZkUtils.getChildrenParentMayNotExist(zkClient, ZkUtils.BrokerIdsPath).sorted
brokerIds.map(_.toInt).map(getBrokerInfo(zkClient, _)).filter(_.isDefined).map(_.get)
}
Kafka for me is new product too. I can't comment anything.
from spring-integration-kafka.
I found the reason. /etc/hosts contained a comma as a separator....
127.0.0.1 localhost, linux-...
When I fixed it and restarted Kafka the application was started correctly.
Thanks for the advises. And please add error info in doGetBrokerAddresses() to avoid anonymous java.lang.NullPointerException.
from spring-integration-kafka.
Thank you for the final solution!
Yes, we definitely should fix it.
Doing that now...
from spring-integration-kafka.
Well, I'm not sure that we can do here so much:
java.lang.NullPointerException
at scala.Predef$.Integer2int(Predef.scala:392)
at kafka.client.ClientUtils$$anonfun$parseBrokerList$1.apply(ClientUtils.scala:103)
at kafka.client.ClientUtils$$anonfun$parseBrokerList$1.apply(ClientUtils.scala:102)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at kafka.client.ClientUtils$.parseBrokerList(ClientUtils.scala:102)
at org.springframework.integration.kafka.core.DefaultConnectionFactory.refreshMetadata(DefaultConnectionFactory.java:175)
Looks like Kafka should take care about the null
for the port.
Anyway, I'll throw some IllegalState
for the ClientUtils$.parseBrokerList
with the appropriate brokerAddressesAsString
to see the issue in the logs.
from spring-integration-kafka.
See #98
from spring-integration-kafka.
Related Issues (20)
- Enhancement: Graceful shutdown of async producers HOT 8
- Add pause/resume to KafkaMessageSource
- Fix Transaction Synchronization
- Set assigned = false in KafkaMessageSource when partitions are revoked HOT 1
- Allow max.poll.records > 1
- TimeoutException on upgrading spring-kafka libraries to 2.1.0 or above HOT 3
- Consider adding `payloadType` to KafkaMessageDrivenChannelAdapterSpec HOT 3
- jacksonVersion on master regressed from 3.1.4.RELEASE HOT 2
- Document Consumer and Producer-Initiated Transactions in SI Outbound Adapter HOT 2
- Support topicPattern in KafkaMessageSource
- KMS: Support async commits, groupId and clientId overrides
- Upgrade to Jackson 2.10 HOT 1
- Support custom Producer RecordMessageConverter
- Automatically set "security.protocol" property to "SSL" if "ssl" property is set HOT 2
- Consider adding MessageChannels backed by a Kafka topic for persistence
- Move to spring-integration repo HOT 4
- I notice that offsets are going up in increments of two HOT 3
- ClassCastException when using both spring-integration-kafka and spring-cloud-starter-bus-kafka HOT 5
- Add a deprecation/migration warning HOT 1
- About RCE 0Days Vulnerability HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-integration-kafka.