How to push (produce ) messages into the Kafka broker using java?
How to push (produce ) messages into the Kafka broker using java
- First, create the properties class object for loading the Kafka producer properties.
- After Connection creation of Kafka producer use the send method to push the message into the broker.
- Finally, Close the Kafka producer connection.
import java.util.Properties;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
/**
*
* @author:Janardhan Randhi
* @Date:Oct 23, 2018
* @Class: This class push the messages into kafka broker.
*/
public class Producer
{
public static void main(String[] args) {
Properties properties = new Properties();
properties.put("bootstrap.servers", "localhost:9092");
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
KafkaProducer kafkaProducer = new KafkaProducer(properties);
try {
for (int i = 0; i < 100; i++) {
System.out.println(i);
kafkaProducer.send(new ProducerRecord("janardhan", Integer.toString(i), "test message - " + i));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
kafkaProducer.close();
}
}
}
I really like your article. It’s evident that you have a lot knowledge on this topic. Your points are well made and relatable. Thanks for writing engaging and interesting material. apple phone mockup
ReplyDeleteI completely understand everything you have said. Actually, I browsed through your additional content articles and I think you happen to be absolutely right. Great job with this online site. iphone psd
ReplyDeleteJust saying thanks wouldn’t just be enough, for the fantastic fluency in your writing.
ReplyDeleteadditional reading
Hey! Good stuff, please keep us posted when you post something like that! device mockup
ReplyDeleteAs soon as I found this internet site I went on reddit to share some of the love with them. اردو شاعری Naveed Ahmed
ReplyDeleteI gotta favorite this web site it seems very useful very beneficial 예스 카지노
ReplyDelete---------------------------
Hi my friend! I want to say that this article is amazing, nice written and include almost all important infos. I would like to see more posts like this . 더킹 카지노
I think other site proprietors should take this web site as an model, very clean and great user friendly style and design, let alone the content. You’re an expert in this topic! 안전놀이터
ReplyDelete--------------------------------------------------------------------------------------------------------------------------------
I believe that is among the most significant information for me. And i’m satisfied studying your article. But wanna observation on some normal things, The web site style is perfect, the articles is in point of fact excellent . Excellent task, cheers. 스포츠중계
Hi I am so delighted I found your blog page, I really found you by accident, while I was browsing on Yahoo for something else, Anyways I am here now and would just like to say cheers for a incredible post and a all round interesting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the excellent job. https://royalcbd.com/product/cbd-oil-2500mg/
ReplyDeleteI appreciate your work , thanks for all the informative blog posts. 먹튀검증
ReplyDeleteThank you, I’ve recently been searching for info about this subject for ages and yours is the best I’ve found so far. mlb중계
ReplyDelete-------------------------------------------------------
thanx for such a fantastic website. Where else could someone get that kind of info written in such a perfect way? I have a presentation that I am presently working on, and I have been on the look out for such information. 해외스포츠중계
First, let’s kill off a genuine fabrication: You can not use a reverse cellular phone number lookup for totally free anywhere, anytime. top development companies
ReplyDeletezxc
ReplyDeleteThey are the public safety and security agency for the brokerage industry and they specialize in helping brokers adhere to all applicable rules and regulations as well as educating brokers on the laws. For more information about rules and regulation of mortgage loan, Maine FHA loan.
ReplyDeleteI really enjoy reading webdesign studios and also appreciate your work.
ReplyDeleteWhile its outside is certainly eye catching, the inside of the vessel is arguably just as impressive if recently released renderings for the design are anything to go by.
ReplyDeletehttps://www.betting33.com
Described as the "superstar area of the yacht," Escalade's huge saloon, which holds a mirrored ceiling, is split into two sections, with a kitchen on one side, and a lavish lounge area and a raised dining area on the other.
ReplyDeletehttps://www.syy577.com
In addition, the yacht has four en suite cabins, a large cinema screen, various sunbathing areas, an onboard garage with room for a tender boat and two jet skis, and a glass bottomed hot tub.
ReplyDeletehttps://www.dok222.com
While the Escalade concept hasn't been picked up by a shipyard as yet, Akalın, who has been working with Anwigema on the project since 2019, says they've received plenty of interest from potential buyers and he's confident it will be hitting the waters in the not too distant future.
ReplyDeletehttps://www.ccclub700.com
"She is the design that meets the needs of the modern world," he adds, explaining the project would take between six to 10 months to complete "with the right planning" once funding is secured.
ReplyDeletehttps://www.hgame75.com
laptops batteries
ReplyDeleteHP Compaq Presario g62 Battery https://www.all-laptopbattery.com/hp-compaq-presario-g62.html
HP Elitebook 8760w Battery https://www.all-laptopbattery.com/hp-elitebook-8760w.html
HP Mini 3100 Battery https://www.all-laptopbattery.com/hp-mini-3100.html
Akku Acer Aspire 7741z http://www.laptop-akkus.com/acer-aspire-7741z.html
Akku Acer Aspire v3-771 http://www.laptop-akkus.com/acer-aspire-v3-771.html
Akku Acer Gateway nv74 http://www.laptop-akkus.com/acer-gateway-nv74.html
I'm also visiting this site regularly, this web site is really nice and the users are genuinely sharing good thoughts.design firm la
ReplyDeletehttps://www.all-laptopbattery.com/asus-g73s.html ASUS G73S Battery
ReplyDeletehttps://www.all-laptopbattery.com/ASUS-g71v.html ASUS G71V Battery
https://www.all-laptopbattery.com/asus-a32-k55.html ASUS A32-K55 Battery
http://www.laptop-akkus.com/hp-envy-14-sleekbook.html HP ENVY 14
http://www.laptop-akkus.com/hp-elitebook-8530p.html HP EliteBook 8530p
http://www.laptop-akkus.com/hp-envy-dv7-7000.html HP Envy DV7-7000
https://www.dnfl150.com/gatsby
ReplyDeletehttps://www.dnfl150.com/33casino
https://www.dnfl150.com/ondasino
https://www.dnfl150.com
https://www.ajp150.com/theking
ReplyDeletehttps://www.ajp150.com/sands
https://www.ajp150.com/first
https://www.ajp150.com/33casino
https://www.ajp150.com/worldcasino
https://www.ajp150.com/korea
https://www.ajp150.com/
In spite of its recognized significance, the message is frequently the most disregarded and belittled part of a showcasing correspondences crusade. Once made, it's only sometimes examined. whats mod apks
ReplyDeletehttps://www.omgab.com 우리카지노사이트
ReplyDeletehttps://www.omgab.com/theking 더킹카지노
https://www.omgab.com/sands 샌즈카지노
https://www.omgab.com/first 퍼스트카지노
https://www.omgab.com/yes 예스카지노
https://www.omgab.com/super 슈퍼카지노
https://www.omgab.com/gatsby 개츠비카지노
https://www.omgab.com/33 33카지노
https://www.omgab.com/world 월드카지노
https://www.omgab.com/merit 메리트카지노
https://www.bbdd66.com 우리카지노사이트
ReplyDeletehttps://www.bbdd66.com/theking 더킹카지노
https://www.bbdd66.com/sands 샌즈카지노
https://www.bbdd66.com/first 퍼스트카지노
https://www.bbdd66.com/yes 예스카지노
https://www.bbdd66.com/super 슈퍼카지노
https://www.bbdd66.com/gatsby 개츠비카지노
https://www.bbdd66.com/33 33카지노
https://www.bbdd66.com/world 월드카지노
https://www.bbdd66.com/merit 메리트카지노
https://www.omgqq.com 우리카지노사이트
ReplyDeletehttps://www.omgqq.com/thekingcasino 더킹카지노
https://www.omgqq.com/sandscasino 샌즈카지노
https://www.omgqq.com/firstcasino 퍼스트카지노
https://www.omgqq.com/yescasino 예스카지노
https://www.omgqq.com/supercasino 슈퍼카지노
https://www.omgqq.com/gatsbycasino 개츠비카지노
https://www.omgqq.com/33casino 33카지노
https://www.omgqq.com/worldcasino 월드카지노
https://www.omgqq.com/merit 메리트카지노
When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. fx마진거래
ReplyDeleteBelow you will understand what is important, the idea provides one of the links with an exciting site: fx마진거래
ReplyDeleteThere is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. receive SMS free
ReplyDeleteI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks... clothing designer Slough
ReplyDeletehttps://www.oobbg.com 우리카지노사이트
ReplyDeletehttps://www.oobbg.com/theking 더킹카지노
https://www.oobbg.com/sands 샌즈카지노
https://www.oobbg.com/first 퍼스트카지노
https://www.oobbg.com/yes 예스카지노
https://www.oobbg.com/coin 코인카지노
https://www.oobbg.com/33 33카지노
https://www.oobbg.com/world 월드카지노
https://www.oobbg.com/merit 메리트카지노
https://www.oobbg.com/gatsby 개츠비카지노
They refine those designs via daily updates and frequent communication product design companies.
ReplyDeletecompany logo design
Thank you for sharing this. It was helpful. Keep sharing such syuff.
ReplyDeleteAlso checkout Nulls Clash.
Yes I also wanted to ask this also. Thanks for sharing!
ReplyDeleteGreat! We will be connecting to this enormous post on our site. Continue the good writing.
ReplyDeletemobile design agency
The life of a freight broker is anything but routine. Find out here what a freight broker is, what a freight broker does, how they do it, when they do it, with whom they do it and why they do it. LOCAL MORTGAGE SERVICES EDMONTON
ReplyDelete“Greetings! Very helpful advice in this particular article! It is the little changes that produce the most significant changes. Thanks a lot for sharing!” https://joinlive77.com/
ReplyDeletegoogle 948
ReplyDeletegoogle 949
google 950
google 951
google 952
Great post I have to say and thanks for the info. Education is definitely a complicated subject. However, it remains one of the main themes of our time. I appreciate your post and I look forward to more.
ReplyDeleteI really like and appreciate your blog post. Much thanks again. Want more.
ReplyDeleteprivnote
Excellent! Thanks for sharing such a great information.. It really helpful to me. Are you interested in free packs Tokens, Packs, and other exclusive in-game items and freebies? if yes then I share one blog about 2k locker Code, read it once.
ReplyDeletePublic Relationship of Real estate professionals (NAR) conjecture: 6% in 2016. toprankinmortgages
ReplyDeleteProperty mortgage is a popular way to finance the purchase of a home or other real estate. toprankinmortgages.com
ReplyDeleteDedicated effort In fine style
ReplyDeleteDesirable It looks like you've put a lot of work into this.
ReplyDelete"Finding the right mortgage can be stressful, but my broker made it a breeze. They took care of all the paperwork and kept me informed at every stage." toprankinmortgages.com
ReplyDelete