<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can I trigger a function when a specific file type is requested? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/can-i-trigger-a-function-when-a-specific-file-type-is-requested/m-p/326231#M13232</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I have a question that involves a little bit of architecture and may sound a little bit of 'chew this for me cause my teeth didn't grow yet'.&lt;/P&gt;
&lt;P&gt;I have the following use case: When a request arrives into Nuxeo (REST API), I want to fetch data from a 3rd party service and answer this data into the response &lt;STRONG&gt;IF&lt;/STRONG&gt; a specific document type is part of the set of files that are requested.&lt;/P&gt;
&lt;P&gt;For example, suppose you are dealing with Nuxeo for Adobe CC Connector inside Adobe InDesign. It's standard behavior is to fetch all the assets under &lt;EM&gt;file&lt;/EM&gt; document type and retrieve them into the connector's view. This view allows you to insert the assets into the canvas.&lt;/P&gt;
&lt;P&gt;Now, suppose that you have a document type registered as &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; and it inherits from &lt;EM&gt;file&lt;/EM&gt; document type. It will be retrieved within the InDesign request for files and attachments. Now, when this happens, when this &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; file is requested, I want it to fire a request to a 3rd party service and, when it answers, I compile the contents of the file which is a .csv and answers the request for the file with these data in it.&lt;/P&gt;
&lt;P&gt;One can notice that this use case exists because of this specific requirement: the &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; fresh data needs ALWAYS to be kept in this 3rd party service. There is no other way around it.&lt;/P&gt;
&lt;P&gt;Now the questions:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Can it be done?&lt;/LI&gt;
&lt;LI&gt;With which approach can it be done? A listener? (I don't really know if it can be done with a listener. With what can it be done?)&lt;/LI&gt;
&lt;LI&gt;What are the steps that I need to implement to achieve that? (I'm very new and don't know the whole architecture). It would be nice to get an answer like: 1) bootstrap a multi-module project; 2) bootstrap a package; 3) bootstrap a service; 4)  Bootstrap a listener; 5) write method into the listener; etc.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Sorry for this long post and question, but am really looking forward to get my hands on Nuxeo and this will give me a great taste of the experience and probably will understand a great part of its features, serving as an enhanced 'helloworld'.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 11:37:35 GMT</pubDate>
    <dc:creator>Carlos_Gregorek</dc:creator>
    <dc:date>2019-09-16T11:37:35Z</dc:date>
    <item>
      <title>Can I trigger a function when a specific file type is requested?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-i-trigger-a-function-when-a-specific-file-type-is-requested/m-p/326231#M13232</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I have a question that involves a little bit of architecture and may sound a little bit of 'chew this for me cause my teeth didn't grow yet'.&lt;/P&gt;
&lt;P&gt;I have the following use case: When a request arrives into Nuxeo (REST API), I want to fetch data from a 3rd party service and answer this data into the response &lt;STRONG&gt;IF&lt;/STRONG&gt; a specific document type is part of the set of files that are requested.&lt;/P&gt;
&lt;P&gt;For example, suppose you are dealing with Nuxeo for Adobe CC Connector inside Adobe InDesign. It's standard behavior is to fetch all the assets under &lt;EM&gt;file&lt;/EM&gt; document type and retrieve them into the connector's view. This view allows you to insert the assets into the canvas.&lt;/P&gt;
&lt;P&gt;Now, suppose that you have a document type registered as &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; and it inherits from &lt;EM&gt;file&lt;/EM&gt; document type. It will be retrieved within the InDesign request for files and attachments. Now, when this happens, when this &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; file is requested, I want it to fire a request to a 3rd party service and, when it answers, I compile the contents of the file which is a .csv and answers the request for the file with these data in it.&lt;/P&gt;
&lt;P&gt;One can notice that this use case exists because of this specific requirement: the &lt;STRONG&gt;myDocumentType&lt;/STRONG&gt; fresh data needs ALWAYS to be kept in this 3rd party service. There is no other way around it.&lt;/P&gt;
&lt;P&gt;Now the questions:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Can it be done?&lt;/LI&gt;
&lt;LI&gt;With which approach can it be done? A listener? (I don't really know if it can be done with a listener. With what can it be done?)&lt;/LI&gt;
&lt;LI&gt;What are the steps that I need to implement to achieve that? (I'm very new and don't know the whole architecture). It would be nice to get an answer like: 1) bootstrap a multi-module project; 2) bootstrap a package; 3) bootstrap a service; 4)  Bootstrap a listener; 5) write method into the listener; etc.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Sorry for this long post and question, but am really looking forward to get my hands on Nuxeo and this will give me a great taste of the experience and probably will understand a great part of its features, serving as an enhanced 'helloworld'.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 11:37:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-i-trigger-a-function-when-a-specific-file-type-is-requested/m-p/326231#M13232</guid>
      <dc:creator>Carlos_Gregorek</dc:creator>
      <dc:date>2019-09-16T11:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can I trigger a function when a specific file type is requested?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-i-trigger-a-function-when-a-specific-file-type-is-requested/m-p/326232#M13233</link>
      <description>&lt;P&gt;It sounds like a listener would be your best bet as it would give you a lot of flexibility in terms of logic.&lt;/P&gt;
&lt;P&gt;In point 3, you have the basic idea already - you may want to consider creating a custom marketplace package which is easy to scaffold via the nuxeo cli bootstrap command. Check out this documentation for how to contribute your own listener: &lt;A href="https://doc.nuxeo.com/nxdoc/events-and-messages/#registering-an-event-listener"&gt;https://doc.nuxeo.com/nxdoc/events-and-messages/#registering-an-event-listener&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I'd also recommend checking out university.nuxeo.com and in particular the Developer learning track&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:53:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-i-trigger-a-function-when-a-specific-file-type-is-requested/m-p/326232#M13233</guid>
      <dc:creator>Jackie_A</dc:creator>
      <dc:date>2019-10-02T12:53:18Z</dc:date>
    </item>
  </channel>
</rss>

