Hi Cody, Sorry, i realized afterwards, i should not ask here. My actual program is spark-streaming and i used kafka for input streaming.
Thanks, Vinti On Mon, Feb 29, 2016 at 1:46 PM, Cody Koeninger <c...@koeninger.org> wrote: > Does this issue involve Spark at all? Otherwise you may have better luck > on a perl or kafka related list. > > On Mon, Feb 29, 2016 at 3:26 PM, Vinti Maheshwari <vinti.u...@gmail.com> > wrote: > >> Hi All, >> >> I wrote kafka producer using kafka perl api, But i am getting error when >> i am passing variable for sending message while if i am hard coding the >> message data it's not giving any error. >> >> Perl program, where i added kafka producer code: >> >> try { >> $kafka_connection = Kafka::Connection->new( host => >> $hadoop_server, port => '6667' ); >> $producer = Kafka::Producer->new( Connection => >> $kafka_connection ); >> my $topic = 'test1'; >> my $partition = 0; >> my $message = $hadoop_str; >> my $response = $producer->send( >> $topic, # topic >> $partition, # partition >> >> #"56b4b2b23c24c3608376d1ea,/obj/i386/ui/lib/access/daemon_map.So.gcda,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0" >> # message >> $hadoop_str >> #"t1,f9,1,1,1" >> ); >> } catch { >> my $error = $_; >> if ( blessed( $error ) && $error->isa( >> 'Kafka::Exception' ) ) { >> warn 'Error: (', $error->code, ') ', >> $error->message, "\n"; >> exit; >> } else { >> die $error; >> } >> };# CCLib::run_system_cmd( $cmd ); >> } >> >> Error Log: -bash-3.2$ ./stream_binary_hadoop.pl print (...) interpreted >> as function at ./stream_binary_hadoop.pl line 429. Invalid argument: >> message = >> 56b4b2b23c24c3608376d1ea,/obj/i386/junos/usr.sbin/lmpd/lmpd_repl_msg_idr.gcda,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 >> at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Exception/Class/Base.pm >> line 85. Exception::Class::Base::throw("Kafka::Exception::Producer", >> "code", -1000, "message", "Invalid argument: message = >> 56b4b2b23c24c3608376d1ea,/obj/i38"...) called at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Producer.pm >> line 374 Kafka::Producer::_error(Kafka::Producer=HASH(0x36955f8), -1000, >> "message = 56b4b2b23c24c3608376d1ea,/obj/i386/junos/usr.sbin/l"...) called >> at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Producer.pm >> line 331 Kafka::Producer::send(Kafka::Producer=HASH(0x36955f8), "test1", 0, >> "56b4b2b23c24c3608376d1ea,/obj/i386/junos/usr.sbin/lmpd/lmpd_r"...) called >> at ./stream_binary_hadoop.pl line 175 main::try {...} () called at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm >> line 81 eval {...} called at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm >> line 72 Try::Tiny::try(CODE(0x3692888), Try::Tiny::Catch=REF(0x3692c78)) >> called at ./stream_binary_hadoop.pl line 190 >> main::stream(HASH(0x3692708)) called at ./stream_binary_hadoop.pl line >> 354 main::file_split(HASH(0x36927b0)) called at ./stream_binary_hadoop.pl >> line 413 >> >> at ./stream_binary_hadoop.pl line 188. main::catch {...} (" Invalid >> argument: message = 56b4b2b23c24c3608376d1e"...) called at >> /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm >> line 104 Try::Tiny::try(CODE(0x3692888), Try::Tiny::Catch=REF(0x3692c78)) >> called at ./stream_binary_hadoop.pl line 190 >> main::stream(HASH(0x3692708)) called at ./stream_binary_hadoop.pl line >> 354 main::file_split(HASH(0x36927b0)) called at ./stream_binary_hadoop.pl >> line 413 >> >> >> >> Thank & Regards, >> >> ~Vinti >> > >