Skip to main content

Overview

When we designed the Onix intake for Ingram it was build to ingest publications to Ingram's tenant, and share them through the marketplace. Bookwire had a different need, they didn't wanted their content to be available in the public marketplace, and they wanted to the sell content using different stores of their own, and not only the main one.

Solution

To achieve that, they are creating those stores using the aggregators feature from their main tenant (https://bookwirebrazil.publica.la). Using that new store ID, they set their own platform (BookwireOS) to deliver their content in our SFTP using a specific directory structure.

They deliver the publications files to the root directory as usual, but instead of delivering the Onix files to the /data directory, they use a subdirectory based on the new store ID, following this scheme /data/store_{new-store-id}. For example, for a store with an ID 1234 and an Onix file named 987654321.xml, the final path would be /data/store_1234/987654321.xml.

Another way to achieve this would have been to add a custom field with that store ID in the Onix file, but they couldn't set that from their side.

So, the final structure would be like:

  • 9786550700058.jpg
  • 9786550700058.epub
  • 9786587218014.jpg
  • 9786587218014.epub
  • data/
    • store_71828/
      • 9786550700058.xml
    • store_58547/
      • 9786587218014.xml

We can now get the store ID from the Onix files path. This is done at ProcessOnixEvent.php class, when running the OnixEventCrawler step that process the onix_events to build/update the onix_issues. There, the getSharedTenantId method will extract the store ID from the path (only when the content intake is set with content_intakes.uploads_content_on_behalf_of_tenants = true) and store it in onix_issues.share_with_tenant_id column.

During the last step of the intake (IssueIngestCrawler or IssueUpdateCrawler) we will dispatch the job IngestOnixIssue to send the publication data to Farfalla. In that job we build the payload using the publication data, plus the following properties:

  • show_in_marketplace: from the content intake settings
  • share_with_tenant_id: the store ID we got from the path

From Farfalla's side we will use show_in_marketplace to set the license of the publication, and once the publication has been created, we will use share_with_tenant_id to set to which tenant we should share it, using Farfalla's ShareFromOnix trait.


In summary, the intake will upload the publication to BW's main tenant and then share it with another of their stores. They will only sell from those aggregated stores.


X

Graph View