You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mfan <ch...@gmail.com> on 2015/09/24 23:47:36 UTC

Is there any data streaming example ?

I am trying to stream growing data using activemq-cpp, but not able to
succeed, can I get an example which I can put inside the Producer::run() for
streaming a growing file which contains a simple text format like this below
?
1, S2,i231.1das.j4
2, S4,i123.5das.j2
.....
.....
For now I just have read the whole file and have the producer send the text
message like this in below.  With the PERSISTENT delivery mode, all the
messages supposed to receive were received, however, with the
NON_PERSISTENT, consumer stop receiving in the middle.  I would like to know
why it stop receiving, and also the ultimate goal is to produce for a
growing file, not the whole file at one time.  If I can be provided an
example code for streaming/reading the growing file with activemq-cpp, I
would appreciate it.

infile = "filename";
ifstream ifs(infile.c_str());
while (ifs)
{
      getline(ifs, line);
      std::cout << "produce : " << line << "\n";
      std::unique_ptr<TextMessage>
message(session->createTextMessage(line));
      producer->send(message.get());
}




--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-data-streaming-example-tp4702276.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Is there any data streaming example ?

Posted by Chaomei Lo <ch...@gmail.com>.
Sometime consumer received the message not the same order as they were
sent.  What the problem it could be ?

Thanks.

On Thu, Sep 24, 2015 at 5:35 PM, Timothy Bish <ta...@gmail.com> wrote:

> On 09/24/2015 08:14 PM, Chaomei Lo wrote:
> > Tim,
> >
> > Would you please answer this question I have asked in below ?
> >
> > "With the PERSISTENT delivery mode, all the
> > messages supposed to receive were received, however, with the
> > NON_PERSISTENT, consumer stop receiving in the middle.  I would like to
> know
> > why it stop receiving"
> >
> > Thanks.
>
> Without more detailed information about what the application is doing it
> would be difficult to say, perhaps the send exceeds the memory limit and
> cannot send any additional messages, or could be something completely
> different.  Have a look at your broker logs when this happens to see if
> it informs you of the situation.
>
> >
> > On Thu, Sep 24, 2015 at 2:58 PM, Timothy Bish <ta...@gmail.com>
> wrote:
> >
> >> On 09/24/2015 05:47 PM, mfan wrote:
> >>> I am trying to stream growing data using activemq-cpp, but not able to
> >>> succeed, can I get an example which I can put inside the
> Producer::run()
> >> for
> >>> streaming a growing file which contains a simple text format like this
> >> below
> >>> ?
> >>> 1, S2,i231.1das.j4
> >>> 2, S4,i123.5das.j2
> >>> .....
> >>> .....
> >>> For now I just have read the whole file and have the producer send the
> >> text
> >>> message like this in below.  With the PERSISTENT delivery mode, all the
> >>> messages supposed to receive were received, however, with the
> >>> NON_PERSISTENT, consumer stop receiving in the middle.  I would like to
> >> know
> >>> why it stop receiving, and also the ultimate goal is to produce for a
> >>> growing file, not the whole file at one time.  If I can be provided an
> >>> example code for streaming/reading the growing file with activemq-cpp,
> I
> >>> would appreciate it.
> >>>
> >>> infile = "filename";
> >>> ifstream ifs(infile.c_str());
> >>> while (ifs)
> >>> {
> >>>       getline(ifs, line);
> >>>       std::cout << "produce : " << line << "\n";
> >>>       std::unique_ptr<TextMessage>
> >>> message(session->createTextMessage(line));
> >>>       producer->send(message.get());
> >>> }
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>
> http://activemq.2283324.n4.nabble.com/Is-there-any-data-streaming-example-tp4702276.html
> >>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>>
> >> That sort of thing is outside the scope of the ActiveMQ-CPP library,
> >> it's purpose is to produce and consumer messages from the broker, the
> >> rest is application logic that you'd need to implement in a way best
> >> suited to your use case.
> >>
> >> --
> >> Tim Bish
> >> Sr Software Engineer | RedHat Inc.
> >> tim.bish@redhat.com | www.redhat.com
> >> twitter: @tabish121
> >> blog: http://timbish.blogspot.com/
> >>
> >>
>
>
> --
> Tim Bish
> Sr Software Engineer | RedHat Inc.
> tim.bish@redhat.com | www.redhat.com
> twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>

Re: Is there any data streaming example ?

Posted by Timothy Bish <ta...@gmail.com>.
On 09/24/2015 08:14 PM, Chaomei Lo wrote:
> Tim,
>
> Would you please answer this question I have asked in below ?
>
> "With the PERSISTENT delivery mode, all the
> messages supposed to receive were received, however, with the
> NON_PERSISTENT, consumer stop receiving in the middle.  I would like to know
> why it stop receiving"
>
> Thanks.

Without more detailed information about what the application is doing it
would be difficult to say, perhaps the send exceeds the memory limit and
cannot send any additional messages, or could be something completely
different.  Have a look at your broker logs when this happens to see if
it informs you of the situation.

>
> On Thu, Sep 24, 2015 at 2:58 PM, Timothy Bish <ta...@gmail.com> wrote:
>
>> On 09/24/2015 05:47 PM, mfan wrote:
>>> I am trying to stream growing data using activemq-cpp, but not able to
>>> succeed, can I get an example which I can put inside the Producer::run()
>> for
>>> streaming a growing file which contains a simple text format like this
>> below
>>> ?
>>> 1, S2,i231.1das.j4
>>> 2, S4,i123.5das.j2
>>> .....
>>> .....
>>> For now I just have read the whole file and have the producer send the
>> text
>>> message like this in below.  With the PERSISTENT delivery mode, all the
>>> messages supposed to receive were received, however, with the
>>> NON_PERSISTENT, consumer stop receiving in the middle.  I would like to
>> know
>>> why it stop receiving, and also the ultimate goal is to produce for a
>>> growing file, not the whole file at one time.  If I can be provided an
>>> example code for streaming/reading the growing file with activemq-cpp, I
>>> would appreciate it.
>>>
>>> infile = "filename";
>>> ifstream ifs(infile.c_str());
>>> while (ifs)
>>> {
>>>       getline(ifs, line);
>>>       std::cout << "produce : " << line << "\n";
>>>       std::unique_ptr<TextMessage>
>>> message(session->createTextMessage(line));
>>>       producer->send(message.get());
>>> }
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Is-there-any-data-streaming-example-tp4702276.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>> That sort of thing is outside the scope of the ActiveMQ-CPP library,
>> it's purpose is to produce and consumer messages from the broker, the
>> rest is application logic that you'd need to implement in a way best
>> suited to your use case.
>>
>> --
>> Tim Bish
>> Sr Software Engineer | RedHat Inc.
>> tim.bish@redhat.com | www.redhat.com
>> twitter: @tabish121
>> blog: http://timbish.blogspot.com/
>>
>>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.redhat.com 
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Is there any data streaming example ?

Posted by Chaomei Lo <ch...@gmail.com>.
Tim,

Would you please answer this question I have asked in below ?

"With the PERSISTENT delivery mode, all the
messages supposed to receive were received, however, with the
NON_PERSISTENT, consumer stop receiving in the middle.  I would like to know
why it stop receiving"

Thanks.

On Thu, Sep 24, 2015 at 2:58 PM, Timothy Bish <ta...@gmail.com> wrote:

> On 09/24/2015 05:47 PM, mfan wrote:
> > I am trying to stream growing data using activemq-cpp, but not able to
> > succeed, can I get an example which I can put inside the Producer::run()
> for
> > streaming a growing file which contains a simple text format like this
> below
> > ?
> > 1, S2,i231.1das.j4
> > 2, S4,i123.5das.j2
> > .....
> > .....
> > For now I just have read the whole file and have the producer send the
> text
> > message like this in below.  With the PERSISTENT delivery mode, all the
> > messages supposed to receive were received, however, with the
> > NON_PERSISTENT, consumer stop receiving in the middle.  I would like to
> know
> > why it stop receiving, and also the ultimate goal is to produce for a
> > growing file, not the whole file at one time.  If I can be provided an
> > example code for streaming/reading the growing file with activemq-cpp, I
> > would appreciate it.
> >
> > infile = "filename";
> > ifstream ifs(infile.c_str());
> > while (ifs)
> > {
> >       getline(ifs, line);
> >       std::cout << "produce : " << line << "\n";
> >       std::unique_ptr<TextMessage>
> > message(session->createTextMessage(line));
> >       producer->send(message.get());
> > }
> >
> >
> >
> >
> > --
> > View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-there-any-data-streaming-example-tp4702276.html
> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >
> That sort of thing is outside the scope of the ActiveMQ-CPP library,
> it's purpose is to produce and consumer messages from the broker, the
> rest is application logic that you'd need to implement in a way best
> suited to your use case.
>
> --
> Tim Bish
> Sr Software Engineer | RedHat Inc.
> tim.bish@redhat.com | www.redhat.com
> twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>

Re: Is there any data streaming example ?

Posted by Timothy Bish <ta...@gmail.com>.
On 09/24/2015 05:47 PM, mfan wrote:
> I am trying to stream growing data using activemq-cpp, but not able to
> succeed, can I get an example which I can put inside the Producer::run() for
> streaming a growing file which contains a simple text format like this below
> ?
> 1, S2,i231.1das.j4
> 2, S4,i123.5das.j2
> .....
> .....
> For now I just have read the whole file and have the producer send the text
> message like this in below.  With the PERSISTENT delivery mode, all the
> messages supposed to receive were received, however, with the
> NON_PERSISTENT, consumer stop receiving in the middle.  I would like to know
> why it stop receiving, and also the ultimate goal is to produce for a
> growing file, not the whole file at one time.  If I can be provided an
> example code for streaming/reading the growing file with activemq-cpp, I
> would appreciate it.
>
> infile = "filename";
> ifstream ifs(infile.c_str());
> while (ifs)
> {
>       getline(ifs, line);
>       std::cout << "produce : " << line << "\n";
>       std::unique_ptr<TextMessage>
> message(session->createTextMessage(line));
>       producer->send(message.get());
> }
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-data-streaming-example-tp4702276.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
That sort of thing is outside the scope of the ActiveMQ-CPP library,
it's purpose is to produce and consumer messages from the broker, the
rest is application logic that you'd need to implement in a way best
suited to your use case. 

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.redhat.com 
twitter: @tabish121
blog: http://timbish.blogspot.com/