What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello, i try to find a a way to connect the middleware to the import logic for classic Product Data

UPWG9AYH2
UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet
edited July 2020 in Help

Hello,
i try to find a a way to connect the middleware to the import logic for classic Product Data import. The doc seems a bit outdated here https://documentation.spryker.com/v4/docs/spryker-middleware
So lets imagine my data already passed the middleware and gets flushed() at the end of the pipeline with the WriteStream … in the WriteStream there is another Writer injected which has a write(array $data) method … this Writer should do basically the same as the DataImport would do. So the next step i was looking for is to connect the DataImporter logic via its corresponding facade, but it seems that you cannot connect to that that easy. Looking at the DataImportFacade there is only an import() function which accepts only a DataImporterConfigurationTransfer which is just meant to read from a file by itself (when running data:import command)…
Looking at the documentation for the middleware (see link) you can see, that in the MyModuleBusinessFactory there will be all the steps that should be in my opinion still be hidden in the importer and not be done again in some other modules BusinessFactory … so is this a kind of design flaw at this place or do i miss something? For me this looks like violating the DRY principle since there is already the importer module doing the same stuff.
I would expect that with the importFacade you could do something like import(DataSetInterface $dataset) instead of passing a configuration … any ideas here? Any other solutions?
Best

Comments

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    Okay, i see there was an change to this 9 months ago https://github.com/spryker/data-import-extension/releases

    I think this addressed exactly the issue i got here with an unwanted dependency to the import module. so instead of managing the import process again in the middleware flow, it is now solved via a plugin which can be called from the spryker dataimport module itself and externally from the middleware for example

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    So the outcome of this issue is: Update the documentation in https://documentation.spryker.com/v4/docs/spryker-middleware to match the “new way” 🙂

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Hi Ingo, thank you for the feedback! I forwarded it internally and will set the reminder to myself to re-check after my vacation that it's not got lost.

  • Thomas Lehner
    Thomas Lehner Support Engineer @ Spryker Posts: 289 🏛 - Council (mod)

    Won't. Thank you for the input, Ingo. If you find something wrong with our documentation in the future, you can always propose changes here: https://documentation.spryker.com/docs/about-documentation#contributing-to-the-documentation

  • UPWG9AYH2
    UPWG9AYH2 Posts: 509 🧑🏻‍🚀 - Cadet

    One additional question to this topic. It would be good if somebody could show me how to use the DataSetItemWriterPluginInterface at the one hand for connecting the middleware and at the other hand also for the normal spryker data import. The goal is to write one import logic to handle both cases with one implementation. Best

  • Thomas Lehner
    Thomas Lehner Support Engineer @ Spryker Posts: 289 🏛 - Council (mod)

    Hey Ingo. Queue Data Importer is based on DataSetItemWriterPluginInterface and difference between DataSetItemWriterPluginInterface the old DataSetWriterPluginInterface is that the new one accepts transfer as its write() method argument instead of DataSetInterface instance. Our Devs suggested this ressource for some examples: Does this help you? https://documentation.spryker.com/docs/importing-data-with-queue-data-importer