You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by en...@free.fr on 2004/01/02 09:27:41 UTC
cocoon & JMS
Hi there and happy new year!
Does anyone know a way to trigger a sitemap pipeline in response to a JMS
notification (onMessage()) ?
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by en...@free.fr.
Selon Upayavira <uv...@upaya.co.uk>:
> enrico.maccias@free.fr wrote:
>
> #!/usr/bin/perl
>
> use LWP::UserAgent;
>
> my $userAgent=LWP::UserAgent->new();
> my $response=$userAgent->get("http://localhost:8080/cocoon/your_url");
> open(out, ">file.txt");
> print out $response->content;
> close(out);
>
> Thus, you've asked perl to go get a page from Cocoon by HTTP, and then
> written it to disk. The pipeline can just look for the file where the
> FTP put it.
>
> If you do want to post by HTTP, here's some code:
>
> #!/usr/bin/perl
>
> use LWP 5.64;
>
> my $content = "<xml>Some XML</xml>";
> my $request = HTTP::Request->new("POST");
>
> $request->header("Content-Type","text/xml");
> $request->content($content);
> $request->url("http://yourserver/cocoon/url");
>
> my $ua = LWP::UserAgent->new;
> my $response = $ua->request($request);
>
> if ($response->is_success) {
> print $response->content,"\n";
> } else {
> print "ERROR: ",$response->status_line,"\n";
> }
>
> Does this help?
Yes, it does! :) Thanks a lot!
Enrico.
>
> Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by Upayavira <uv...@upaya.co.uk>.
enrico.maccias@free.fr wrote:
>Selon Upayavira <uv...@upaya.co.uk>:
>
>
> ...
>
>>What do you mean by 'I get notified of their arrival'? Do you mean that
>>they are sent by FTP to the server, and then the server is informed of
>>their arrival?
>>
>>
>
>That's it. The FTP server writes events into an IPC message queue.
>Unfortunatly, without JNI it's hard to program something in Java that
>could communicate with IPC. So, a Perl script does the job. So far, the
>script does the XSLT too. But it is not flexible at all, that's why I'd
>like to send the raw XML files to by Cocoon, maybe via HTTP (or, at the
>begining at this thread I was thinking about some kind of MoM).
>But without JNI, I am compelled to write a Perl HTTP client to send the XML
>files to Cocoon :(
>
>
So, on the server, you need something that'll read of an IPC message
queue, and get Cocoon to do some processing, transforming some files.
Well, once the file is on the server, you don't really need HTTP post.
So you could simply do:
#!/usr/bin/perl
use LWP::UserAgent;
my $userAgent=LWP::UserAgent->new();
my $response=$userAgent->get("http://localhost:8080/cocoon/your_url");
open(out, ">file.txt");
print out $response->content;
close(out);
Thus, you've asked perl to go get a page from Cocoon by HTTP, and then
written it to disk. The pipeline can just look for the file where the
FTP put it.
If you do want to post by HTTP, here's some code:
#!/usr/bin/perl
use LWP 5.64;
my $content = "<xml>Some XML</xml>";
my $request = HTTP::Request->new("POST");
$request->header("Content-Type","text/xml");
$request->content($content);
$request->url("http://yourserver/cocoon/url");
my $ua = LWP::UserAgent->new;
my $response = $ua->request($request);
if ($response->is_success) {
print $response->content,"\n";
} else {
print "ERROR: ",$response->status_line,"\n";
}
Does this help?
Regards, Upayavira
>>I would say, using some combination of flow, HTTP post, the
>>StreamGenerator and processPipelineTo might do you nicely.
>>
>>That way, whatever starts the process off posts the raw data to Cocoon,
>>in XML, using HTTPPost. In flow, you use code like:
>>var fis = new java.io.FileInputStream(new java.io.File("yourfile.xml"));
>>cocoon.processPipelineTo("stream-pipeline", fis);
>>cocoon.sendPage("show-success");
>>That way, the contents of the stream are transformed in a pipeline and
>>then written to disk.
>>
>>Alternatively, you could use the SourceWritingTransformer to do it.
>>
>>I would recommend using HTTP to transfer data, rather than FTP. FTP is
>>an antiquated and complex protocol, and, as you have seen, has no
>>capacity to notify of delivery. Whereas, when data arrives via HTTP, you
>>are free to take that data and place it wherever you want.
>>
>>Hope this helps.
>>
>>Regards, Upayavira
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by en...@free.fr.
Selon Upayavira <uv...@upaya.co.uk>:
> enrico.maccias@free.fr wrote:
>
> >Selon Upayavira <uv...@upaya.co.uk>:
> >
> >
> >
> >>enrico.maccias@free.fr wrote:
> >>
> >>
> >>
> >>>Selon Geoff Howard <co...@leverageweb.com>:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>enrico.maccias@free.fr wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi there and happy new year!
> >>>>>
> >>>>>
> >>>>> Does anyone know a way to trigger a sitemap pipeline in response to a
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>JMS
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>notification (onMessage()) ?
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>A general solution for this has been discussed before but never
> >>>>implemented (here at least). Still, this is certainly possible today
> >>>>with a custom component - but could be a lot of work because you'd need
> >>>>to create a full request environment on your own.
> >>>>
> >>>>But first, I should ask - why? Do you need the response back from the
> >>>>pipeline re-sent as a followup message, or something? Or do you simply
> >>>>need to fire off some business logic which is also done by firing off a
> >>>>pipeline?
> >>>>
> >>>>Geoff
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Actually, I don't need to re-send a followup message. Anyway, I think JMS
> is
> >>>
> >>>
> >>>not important here. I just need to know if there's a way to fire off a
> >>>pipeline without an HTTP request (even if cocoon is used as a servlet)?
> >>>
> >>>
> >>>
> >>>
> >>Why do you want to fire off a pipeline? Because of some kind of
> >>side-effect of the pipeline? What do you want to do with the output of
> >>the pipeline?
> >>
> >>There are ways, but it depends upon what you're trying to achieve.
> >>
> >>Regards, Upayavira
> >>
> >>
> >>
> >>
> >
> >
> >I need to "prepare" some static XML files (mainly XSLTransformations) to be
>
> >later processed/served by a Cocoon-based webapp. Those XML files are dropped
>
> >on an FTP server and I get notified of their arrival... Since I use cocoon
> (as
> >a servlet) I don't want to write an independant Xalan piece of code :)
> >
> >
Thanks for all Upayavira,
> What do you mean by 'I get notified of their arrival'? Do you mean that
> they are sent by FTP to the server, and then the server is informed of
> their arrival?
That's it. The FTP server writes events into an IPC message queue.
Unfortunatly, without JNI it's hard to program something in Java that
could communicate with IPC. So, a Perl script does the job. So far, the
script does the XSLT too. But it is not flexible at all, that's why I'd
like to send the raw XML files to by Cocoon, maybe via HTTP (or, at the
begining at this thread I was thinking about some kind of MoM).
But without JNI, I am compelled to write a Perl HTTP client to send the XML
files to Cocoon :(
>
> I would say, using some combination of flow, HTTP post, the
> StreamGenerator and processPipelineTo might do you nicely.
>
> That way, whatever starts the process off posts the raw data to Cocoon,
> in XML, using HTTPPost. In flow, you use code like:
> var fis = new java.io.FileInputStream(new java.io.File("yourfile.xml"));
> cocoon.processPipelineTo("stream-pipeline", fis);
> cocoon.sendPage("show-success");
> That way, the contents of the stream are transformed in a pipeline and
> then written to disk.
>
> Alternatively, you could use the SourceWritingTransformer to do it.
>
> I would recommend using HTTP to transfer data, rather than FTP. FTP is
> an antiquated and complex protocol, and, as you have seen, has no
> capacity to notify of delivery. Whereas, when data arrives via HTTP, you
> are free to take that data and place it wherever you want.
>
> Hope this helps.
>
> Regards, Upayavira
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by Upayavira <uv...@upaya.co.uk>.
enrico.maccias@free.fr wrote:
>Selon Upayavira <uv...@upaya.co.uk>:
>
>
>
>>enrico.maccias@free.fr wrote:
>>
>>
>>
>>>Selon Geoff Howard <co...@leverageweb.com>:
>>>
>>>
>>>
>>>
>>>
>>>>enrico.maccias@free.fr wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Hi there and happy new year!
>>>>>
>>>>>
>>>>> Does anyone know a way to trigger a sitemap pipeline in response to a
>>>>>
>>>>>
>>>>>
>>>>>
>>>>JMS
>>>>
>>>>
>>>>
>>>>
>>>>>notification (onMessage()) ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>A general solution for this has been discussed before but never
>>>>implemented (here at least). Still, this is certainly possible today
>>>>with a custom component - but could be a lot of work because you'd need
>>>>to create a full request environment on your own.
>>>>
>>>>But first, I should ask - why? Do you need the response back from the
>>>>pipeline re-sent as a followup message, or something? Or do you simply
>>>>need to fire off some business logic which is also done by firing off a
>>>>pipeline?
>>>>
>>>>Geoff
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>Actually, I don't need to re-send a followup message. Anyway, I think JMS is
>>>
>>>
>>>not important here. I just need to know if there's a way to fire off a
>>>pipeline without an HTTP request (even if cocoon is used as a servlet)?
>>>
>>>
>>>
>>>
>>Why do you want to fire off a pipeline? Because of some kind of
>>side-effect of the pipeline? What do you want to do with the output of
>>the pipeline?
>>
>>There are ways, but it depends upon what you're trying to achieve.
>>
>>Regards, Upayavira
>>
>>
>>
>>
>
>
>I need to "prepare" some static XML files (mainly XSLTransformations) to be
>later processed/served by a Cocoon-based webapp. Those XML files are dropped
>on an FTP server and I get notified of their arrival... Since I use cocoon (as
>a servlet) I don't want to write an independant Xalan piece of code :)
>
>
What do you mean by 'I get notified of their arrival'? Do you mean that
they are sent by FTP to the server, and then the server is informed of
their arrival?
I would say, using some combination of flow, HTTP post, the
StreamGenerator and processPipelineTo might do you nicely.
That way, whatever starts the process off posts the raw data to Cocoon,
in XML, using HTTPPost. In flow, you use code like:
var fis = new java.io.FileInputStream(new java.io.File("yourfile.xml"));
cocoon.processPipelineTo("stream-pipeline", fis);
cocoon.sendPage("show-success");
That way, the contents of the stream are transformed in a pipeline and
then written to disk.
Alternatively, you could use the SourceWritingTransformer to do it.
I would recommend using HTTP to transfer data, rather than FTP. FTP is
an antiquated and complex protocol, and, as you have seen, has no
capacity to notify of delivery. Whereas, when data arrives via HTTP, you
are free to take that data and place it wherever you want.
Hope this helps.
Regards, Upayavira
>Enrico
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cocoon + postgresSQL
Posted by Geoff Howard <co...@leverageweb.com>.
beyaRecords - The home Urban music wrote:
> Hi,
> is anybody using cocoon and postgresql to query a stored procedure? I am
> trying to return a resultset:
> select * from tablename, and am having problems writing the procedure.
I've noticed that you (and others) appear to be using "reply-to" on the
latest message as a short cut to starting a new discussion thread
(asking a new question). This is probably causing many of your
questions to be ignored because many threaded email clients will show
your post as part of an unrelated thread even though the subject line
has changed.
When posting a new question you will get noticed more, help archive
searches, and frustrate people less if you create a new message to
users@cocoon.apache.org instead of using "reply-to" on an unrelated message.
Geoff
> On 2 Jan 2004, at 15:51, enrico.maccias@free.fr wrote:
>
>> Selon Upayavira <uv...@upaya.co.uk>:
>>> enrico.maccias@free.fr wrote:
>>>> Selon Geoff Howard <co...@leverageweb.com>:
>>>>> enrico.maccias@free.fr wrote:
>>>>>
>>>>>> Hi there and happy new year!
>>>>>> Does anyone know a way to trigger a sitemap pipeline in response
>>>>>> to a
>>>>> JMS
>>>>>> notification (onMessage()) ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Cocoon + postgresSQL
Posted by beyaRecords - The home Urban music <uz...@beya-records.com>.
Hi,
is anybody using cocoon and postgresql to query a stored procedure? I
am trying to return a resultset:
select * from tablename, and am having problems writing the procedure.
regards
Uzo
p.s. I know that this could be considered to be more of a postgresql
forum question, but I thought it would be better to ask people who were
using the same development platform as me ;-)
On 2 Jan 2004, at 15:51, enrico.maccias@free.fr wrote:
> Selon Upayavira <uv...@upaya.co.uk>:
>
>> enrico.maccias@free.fr wrote:
>>
>>> Selon Geoff Howard <co...@leverageweb.com>:
>>>
>>>
>>>
>>>> enrico.maccias@free.fr wrote:
>>>>
>>>>
>>>>> Hi there and happy new year!
>>>>>
>>>>>
>>>>> Does anyone know a way to trigger a sitemap pipeline in response
>>>>> to a
>>>>>
>>>>>
>>>> JMS
>>>>
>>>>
>>>>> notification (onMessage()) ?
>>>>>
>>>>>
>>>> A general solution for this has been discussed before but never
>>>> implemented (here at least). Still, this is certainly possible
>>>> today
>>>> with a custom component - but could be a lot of work because you'd
>>>> need
>>>> to create a full request environment on your own.
>>>>
>>>> But first, I should ask - why? Do you need the response back from
>>>> the
>>>> pipeline re-sent as a followup message, or something? Or do you
>>>> simply
>>>> need to fire off some business logic which is also done by firing
>>>> off a
>>>> pipeline?
>>>>
>>>> Geoff
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> Actually, I don't need to re-send a followup message. Anyway, I
>>> think JMS is
>>
>>> not important here. I just need to know if there's a way to fire off
>>> a
>>> pipeline without an HTTP request (even if cocoon is used as a
>>> servlet)?
>>>
>>>
>> Why do you want to fire off a pipeline? Because of some kind of
>> side-effect of the pipeline? What do you want to do with the output of
>> the pipeline?
>>
>> There are ways, but it depends upon what you're trying to achieve.
>>
>> Regards, Upayavira
>>
>>
>
>
> I need to "prepare" some static XML files (mainly XSLTransformations)
> to be
> later processed/served by a Cocoon-based webapp. Those XML files are
> dropped
> on an FTP server and I get notified of their arrival... Since I use
> cocoon (as
> a servlet) I don't want to write an independant Xalan piece of code :)
>
> Enrico
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by en...@free.fr.
Selon Upayavira <uv...@upaya.co.uk>:
> enrico.maccias@free.fr wrote:
>
> >Selon Geoff Howard <co...@leverageweb.com>:
> >
> >
> >
> >>enrico.maccias@free.fr wrote:
> >>
> >>
> >>>Hi there and happy new year!
> >>>
> >>>
> >>> Does anyone know a way to trigger a sitemap pipeline in response to a
> >>>
> >>>
> >>JMS
> >>
> >>
> >>>notification (onMessage()) ?
> >>>
> >>>
> >>A general solution for this has been discussed before but never
> >>implemented (here at least). Still, this is certainly possible today
> >>with a custom component - but could be a lot of work because you'd need
> >>to create a full request environment on your own.
> >>
> >>But first, I should ask - why? Do you need the response back from the
> >>pipeline re-sent as a followup message, or something? Or do you simply
> >>need to fire off some business logic which is also done by firing off a
> >>pipeline?
> >>
> >>Geoff
> >>
> >>
> >>
> >>
> >>
> >
> >Actually, I don't need to re-send a followup message. Anyway, I think JMS is
>
> >not important here. I just need to know if there's a way to fire off a
> >pipeline without an HTTP request (even if cocoon is used as a servlet)?
> >
> >
> Why do you want to fire off a pipeline? Because of some kind of
> side-effect of the pipeline? What do you want to do with the output of
> the pipeline?
>
> There are ways, but it depends upon what you're trying to achieve.
>
> Regards, Upayavira
>
>
I need to "prepare" some static XML files (mainly XSLTransformations) to be
later processed/served by a Cocoon-based webapp. Those XML files are dropped
on an FTP server and I get notified of their arrival... Since I use cocoon (as
a servlet) I don't want to write an independant Xalan piece of code :)
Enrico
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by Upayavira <uv...@upaya.co.uk>.
enrico.maccias@free.fr wrote:
>Selon Geoff Howard <co...@leverageweb.com>:
>
>
>
>>enrico.maccias@free.fr wrote:
>>
>>
>>>Hi there and happy new year!
>>>
>>>
>>> Does anyone know a way to trigger a sitemap pipeline in response to a
>>>
>>>
>>JMS
>>
>>
>>>notification (onMessage()) ?
>>>
>>>
>>A general solution for this has been discussed before but never
>>implemented (here at least). Still, this is certainly possible today
>>with a custom component - but could be a lot of work because you'd need
>>to create a full request environment on your own.
>>
>>But first, I should ask - why? Do you need the response back from the
>>pipeline re-sent as a followup message, or something? Or do you simply
>>need to fire off some business logic which is also done by firing off a
>>pipeline?
>>
>>Geoff
>>
>>
>>
>>
>>
>
>Actually, I don't need to re-send a followup message. Anyway, I think JMS is
>not important here. I just need to know if there's a way to fire off a
>pipeline without an HTTP request (even if cocoon is used as a servlet)?
>
>
Why do you want to fire off a pipeline? Because of some kind of
side-effect of the pipeline? What do you want to do with the output of
the pipeline?
There are ways, but it depends upon what you're trying to achieve.
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by en...@free.fr.
Selon Geoff Howard <co...@leverageweb.com>:
> enrico.maccias@free.fr wrote:
> > Hi there and happy new year!
> >
> >
> > Does anyone know a way to trigger a sitemap pipeline in response to a
> JMS
> > notification (onMessage()) ?
>
> A general solution for this has been discussed before but never
> implemented (here at least). Still, this is certainly possible today
> with a custom component - but could be a lot of work because you'd need
> to create a full request environment on your own.
>
> But first, I should ask - why? Do you need the response back from the
> pipeline re-sent as a followup message, or something? Or do you simply
> need to fire off some business logic which is also done by firing off a
> pipeline?
>
> Geoff
>
>
>
Actually, I don't need to re-send a followup message. Anyway, I think JMS is
not important here. I just need to know if there's a way to fire off a
pipeline without an HTTP request (even if cocoon is used as a servlet)?
Enrico
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cocoon & JMS
Posted by Geoff Howard <co...@leverageweb.com>.
enrico.maccias@free.fr wrote:
> Hi there and happy new year!
>
>
> Does anyone know a way to trigger a sitemap pipeline in response to a JMS
> notification (onMessage()) ?
A general solution for this has been discussed before but never
implemented (here at least). Still, this is certainly possible today
with a custom component - but could be a lot of work because you'd need
to create a full request environment on your own.
But first, I should ask - why? Do you need the response back from the
pipeline re-sent as a followup message, or something? Or do you simply
need to fire off some business logic which is also done by firing off a
pipeline?
Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org