Jelajahi Sumber

Finished the project to export

Jean Sumara 5 tahun lalu
induk
melakukan
c7b608323b

+ 0 - 5
.env.example

@@ -1,5 +0,0 @@
-HOST_AMQP=
-PORT_AMQP=
-USER_AMQP=
-PASS_AMQP=
-FTTH_AMQP=

+ 3 - 2
composer.json

@@ -18,8 +18,9 @@
     "ext-curl": "*",
     "kriswallsmith/buzz": "^1.1",
     "nyholm/psr7": "^1.2",
-    "aws/aws-sdk-php": "2.*",
-    "guzzle/guzzle": "3.7.*"
+    "aws/aws-sdk-php": "3.*",
+    "guzzle/guzzle": "3.7.*",
+    "ext-simplexml": "*"
   },
   "autoload": {
     "psr-4": {

+ 458 - 32
composer.lock

@@ -4,47 +4,68 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "892b7dd6d0f7fd9cbdf48b89fb7efd0d",
+    "content-hash": "ac78c96b02ba0340303688dbe6a08100",
     "packages": [
         {
             "name": "aws/aws-sdk-php",
-            "version": "2.8.31",
+            "version": "3.135.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "64fa4b07f056e338a5f0f29eece75babaa83af68"
+                "reference": "254f168f90b1846ffb3f70594280e66b9f10a85e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/64fa4b07f056e338a5f0f29eece75babaa83af68",
-                "reference": "64fa4b07f056e338a5f0f29eece75babaa83af68",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/254f168f90b1846ffb3f70594280e66b9f10a85e",
+                "reference": "254f168f90b1846ffb3f70594280e66b9f10a85e",
                 "shasum": ""
             },
             "require": {
-                "guzzle/guzzle": "~3.7",
-                "php": ">=5.3.3"
+                "ext-json": "*",
+                "ext-pcre": "*",
+                "ext-simplexml": "*",
+                "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0",
+                "guzzlehttp/promises": "^1.0",
+                "guzzlehttp/psr7": "^1.4.1",
+                "mtdowling/jmespath.php": "^2.5",
+                "php": ">=5.5"
             },
             "require-dev": {
-                "doctrine/cache": "~1.0",
+                "andrewsville/php-token-reflection": "^1.4",
+                "aws/aws-php-sns-message-validator": "~1.0",
+                "behat/behat": "~3.0",
+                "doctrine/cache": "~1.4",
+                "ext-dom": "*",
                 "ext-openssl": "*",
-                "monolog/monolog": "~1.4",
-                "phpunit/phpunit": "~4.0",
-                "phpunit/phpunit-mock-objects": "2.3.1",
-                "symfony/yaml": "~2.1"
+                "ext-pcntl": "*",
+                "ext-sockets": "*",
+                "nette/neon": "^2.3",
+                "phpunit/phpunit": "^4.8.35|^5.4.3",
+                "psr/cache": "^1.0",
+                "psr/simple-cache": "^1.0",
+                "sebastian/comparator": "^1.2.3"
             },
             "suggest": {
-                "doctrine/cache": "Adds support for caching of credentials and responses",
-                "ext-apc": "Allows service description opcode caching, request and response caching, and credentials caching",
+                "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
+                "doctrine/cache": "To use the DoctrineCacheAdapter",
+                "ext-curl": "To send requests using cURL",
                 "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
-                "monolog/monolog": "Adds support for logging HTTP requests and responses",
-                "symfony/yaml": "Eases the ability to write manifests for creating jobs in AWS Import/Export"
+                "ext-sockets": "To use client-side monitoring"
             },
             "type": "library",
-            "autoload": {
-                "psr-0": {
-                    "Aws": "src/"
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.0-dev"
                 }
             },
+            "autoload": {
+                "psr-4": {
+                    "Aws\\": "src/"
+                },
+                "files": [
+                    "src/functions.php"
+                ]
+            },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "Apache-2.0"
@@ -67,20 +88,20 @@
                 "s3",
                 "sdk"
             ],
-            "time": "2016-07-25T18:03:20+00:00"
+            "time": "2020-04-20T18:16:34+00:00"
         },
         {
             "name": "doctrine/annotations",
-            "version": "1.10.1",
+            "version": "1.10.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/annotations.git",
-                "reference": "5eb79f3dbdffed6544e1fc287572c0f462bd29bb"
+                "reference": "b9d758e831c70751155c698c2f7df4665314a1cb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/annotations/zipball/5eb79f3dbdffed6544e1fc287572c0f462bd29bb",
-                "reference": "5eb79f3dbdffed6544e1fc287572c0f462bd29bb",
+                "url": "https://api.github.com/repos/doctrine/annotations/zipball/b9d758e831c70751155c698c2f7df4665314a1cb",
+                "reference": "b9d758e831c70751155c698c2f7df4665314a1cb",
                 "shasum": ""
             },
             "require": {
@@ -136,7 +157,7 @@
                 "docblock",
                 "parser"
             ],
-            "time": "2020-04-02T12:33:25+00:00"
+            "time": "2020-04-20T09:18:32+00:00"
         },
         {
             "name": "doctrine/cache",
@@ -375,16 +396,16 @@
         },
         {
             "name": "doctrine/dbal",
-            "version": "v2.10.1",
+            "version": "2.10.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/dbal.git",
-                "reference": "c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8"
+                "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8",
-                "reference": "c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/aab745e7b6b2de3b47019da81e7225e14dcfdac8",
+                "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8",
                 "shasum": ""
             },
             "require": {
@@ -396,9 +417,11 @@
             "require-dev": {
                 "doctrine/coding-standard": "^6.0",
                 "jetbrains/phpstorm-stubs": "^2019.1",
-                "phpstan/phpstan": "^0.11.3",
+                "nikic/php-parser": "^4.4",
+                "phpstan/phpstan": "^0.12",
                 "phpunit/phpunit": "^8.4.1",
-                "symfony/console": "^2.0.5|^3.0|^4.0|^5.0"
+                "symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
+                "vimeo/psalm": "^3.11"
             },
             "suggest": {
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
@@ -463,7 +486,7 @@
                 "sqlserver",
                 "sqlsrv"
             ],
-            "time": "2020-01-04T12:56:21+00:00"
+            "time": "2020-04-20T17:19:26+00:00"
         },
         {
             "name": "doctrine/event-manager",
@@ -1064,6 +1087,195 @@
             "abandoned": "guzzlehttp/guzzle",
             "time": "2013-10-02T20:47:00+00:00"
         },
+        {
+            "name": "guzzlehttp/guzzle",
+            "version": "6.5.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/guzzle/guzzle.git",
+                "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e",
+                "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e",
+                "shasum": ""
+            },
+            "require": {
+                "ext-json": "*",
+                "guzzlehttp/promises": "^1.0",
+                "guzzlehttp/psr7": "^1.6.1",
+                "php": ">=5.5",
+                "symfony/polyfill-intl-idn": "^1.11"
+            },
+            "require-dev": {
+                "ext-curl": "*",
+                "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
+                "psr/log": "^1.1"
+            },
+            "suggest": {
+                "psr/log": "Required for using the Log middleware"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "6.5-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GuzzleHttp\\": "src/"
+                },
+                "files": [
+                    "src/functions_include.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                }
+            ],
+            "description": "Guzzle is a PHP HTTP client library",
+            "homepage": "http://guzzlephp.org/",
+            "keywords": [
+                "client",
+                "curl",
+                "framework",
+                "http",
+                "http client",
+                "rest",
+                "web service"
+            ],
+            "time": "2020-04-18T10:38:46+00:00"
+        },
+        {
+            "name": "guzzlehttp/promises",
+            "version": "v1.3.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/guzzle/promises.git",
+                "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
+                "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GuzzleHttp\\Promise\\": "src/"
+                },
+                "files": [
+                    "src/functions_include.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                }
+            ],
+            "description": "Guzzle promises library",
+            "keywords": [
+                "promise"
+            ],
+            "time": "2016-12-20T10:07:11+00:00"
+        },
+        {
+            "name": "guzzlehttp/psr7",
+            "version": "1.6.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/guzzle/psr7.git",
+                "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
+                "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.4.0",
+                "psr/http-message": "~1.0",
+                "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+            },
+            "provide": {
+                "psr/http-message-implementation": "1.0"
+            },
+            "require-dev": {
+                "ext-zlib": "*",
+                "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
+            },
+            "suggest": {
+                "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.6-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GuzzleHttp\\Psr7\\": "src/"
+                },
+                "files": [
+                    "src/functions_include.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                },
+                {
+                    "name": "Tobias Schultze",
+                    "homepage": "https://github.com/Tobion"
+                }
+            ],
+            "description": "PSR-7 message implementation that also provides common utility methods",
+            "keywords": [
+                "http",
+                "message",
+                "psr-7",
+                "request",
+                "response",
+                "stream",
+                "uri",
+                "url"
+            ],
+            "time": "2019-07-01T23:21:34+00:00"
+        },
         {
             "name": "kriswallsmith/buzz",
             "version": "1.1.0",
@@ -1130,6 +1342,63 @@
             ],
             "time": "2020-03-07T13:42:51+00:00"
         },
+        {
+            "name": "mtdowling/jmespath.php",
+            "version": "2.5.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/jmespath/jmespath.php.git",
+                "reference": "52168cb9472de06979613d365c7f1ab8798be895"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895",
+                "reference": "52168cb9472de06979613d365c7f1ab8798be895",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.4.0",
+                "symfony/polyfill-mbstring": "^1.4"
+            },
+            "require-dev": {
+                "composer/xdebug-handler": "^1.2",
+                "phpunit/phpunit": "^4.8.36|^7.5.15"
+            },
+            "bin": [
+                "bin/jp.php"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.5-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "JmesPath\\": "src/"
+                },
+                "files": [
+                    "src/JmesPath.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                }
+            ],
+            "description": "Declaratively specify how to extract elements from a JSON document",
+            "keywords": [
+                "json",
+                "jsonpath"
+            ],
+            "time": "2019-12-30T18:03:34+00:00"
+        },
         {
             "name": "nyholm/psr7",
             "version": "1.2.1",
@@ -1869,6 +2138,46 @@
             ],
             "time": "2016-08-06T14:39:51+00:00"
         },
+        {
+            "name": "ralouphie/getallheaders",
+            "version": "3.0.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ralouphie/getallheaders.git",
+                "reference": "120b605dfeb996808c31b6477290a714d356e822"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+                "reference": "120b605dfeb996808c31b6477290a714d356e822",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "php-coveralls/php-coveralls": "^2.1",
+                "phpunit/phpunit": "^5 || ^6.5"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/getallheaders.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ralph Khattar",
+                    "email": "ralph.khattar@gmail.com"
+                }
+            ],
+            "description": "A polyfill for getallheaders.",
+            "time": "2019-03-08T08:55:37+00:00"
+        },
         {
             "name": "symfony/console",
             "version": "v4.2.12",
@@ -2190,6 +2499,68 @@
             ],
             "time": "2020-02-27T09:26:54+00:00"
         },
+        {
+            "name": "symfony/polyfill-intl-idn",
+            "version": "v1.15.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-intl-idn.git",
+                "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
+                "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "symfony/polyfill-mbstring": "^1.3",
+                "symfony/polyfill-php72": "^1.10"
+            },
+            "suggest": {
+                "ext-intl": "For best performance"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.15-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Polyfill\\Intl\\Idn\\": ""
+                },
+                "files": [
+                    "bootstrap.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Laurent Bassin",
+                    "email": "laurent@bassin.info"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "idn",
+                "intl",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "time": "2020-03-09T19:04:49+00:00"
+        },
         {
             "name": "symfony/polyfill-mbstring",
             "version": "v1.15.0",
@@ -2249,6 +2620,61 @@
             ],
             "time": "2020-03-09T19:04:49+00:00"
         },
+        {
+            "name": "symfony/polyfill-php72",
+            "version": "v1.15.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-php72.git",
+                "reference": "37b0976c78b94856543260ce09b460a7bc852747"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
+                "reference": "37b0976c78b94856543260ce09b460a7bc852747",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.15-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Polyfill\\Php72\\": ""
+                },
+                "files": [
+                    "bootstrap.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "p@tchwork.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "time": "2020-02-27T09:26:54+00:00"
+        },
         {
             "name": "symfony/yaml",
             "version": "v2.8.52",

src/Flowdat/Export/App/Enum/NotificationEnum.php → src/App/Enum/NotificationEnum.php


+ 23 - 0
src/App/Exporter/ExporterJson.php

@@ -0,0 +1,23 @@
+<?php
+
+
+namespace Flowdat\Export\App\Exporter;
+
+
+class ExporterJson implements Export
+{
+    public static function export($fileName, $data, $header)
+    {
+        echo "Start creating file.".PHP_EOL;
+
+        $path = __DIR__.'/../../Resource/';
+        $pathFileComplete = $path.$fileName;
+        $fp = fopen($pathFileComplete, 'w');
+        fwrite($fp, json_encode($data));
+        fclose($fp);
+
+        echo "Finished create file".PHP_EOL;
+
+        return $pathFileComplete;
+    }
+}

+ 42 - 0
src/App/Exporter/ExporterXml.php

@@ -0,0 +1,42 @@
+<?php
+
+
+namespace Flowdat\Export\App\Exporter;
+
+
+use SimpleXMLElement;
+
+class ExporterXml implements Export
+{
+    public static function export($fileName, $data, $header)
+    {
+        echo "Start creating file.".PHP_EOL;
+
+        $path = __DIR__.'/../../Resource/';
+        $pathFileComplete = $path.$fileName;
+
+        $xml_data = new SimpleXMLElement('<?xml version="1.0"?><datas></datas>');
+
+        self::arrayToXml($data,$xml_data);
+
+        $xml_data->asXML($pathFileComplete);
+
+        echo "Finished create file".PHP_EOL;
+
+        return $pathFileComplete;
+    }
+
+    public static function arrayToXml($data, &$xml_data ) {
+        foreach( $data as $key => $value ) {
+            if( is_array($value) ) {
+                if( is_numeric($key) ){
+                    $key = 'item'.$key;
+                }
+                $subnode = $xml_data->addChild($key);
+                self::arrayToXml($value, $subnode);
+            } else {
+                $xml_data->addChild("$key",htmlspecialchars("$value"));
+            }
+        }
+    }
+}

+ 9 - 0
src/App/Factory/ExportFactory.php

@@ -5,14 +5,23 @@ namespace Flowdat\Export\App\Factory;
 
 
 use Flowdat\Export\App\Exporter\ExporterCsv;
+use Flowdat\Export\App\Exporter\ExporterJson;
+use Flowdat\Export\App\Exporter\ExporterXml;
 
 class ExportFactory
 {
     public static function create($type, $fileName, $data, $header){
         switch ($type){
+            case 'xls':
             case 'csv':
                 return ExporterCsv::export($fileName, $data, $header);
                 break;
+            case 'json':
+                return ExporterJson::export($fileName, $data, null);
+                break;
+            case 'xml':
+                return ExporterXml::export($fileName, $data, null);
+                break;
             default:
                 throw new \Exception("Export don't support this type {$type}");
         }

+ 19 - 12
src/App/Factory/S3Factory.php

@@ -7,24 +7,31 @@ use Aws\S3\S3Client;
 
 class S3Factory
 {
-    public static function send($path, $fileName, $clientName){
+    public static function send($path, $fileName){
         try{
-            $client = S3Client::factory(array(
-                'key'    => getenv('AWS_ACCESS_KEY_ID'),
-                'secret' => getenv('AWS_SECRET_ACCESS_KEY')
-            ));
-
-            $client->headBucket(array('Bucket' => 'flowdat3'));
-
-            $file = "{$clientName}/{$fileName}";
-            echo "Sending $file to S3 AWS".PHP_EOL;
+            $client = new S3Client([
+                'version' => 'latest',
+                'region'  => 'us-east-1',
+                'endpoint' => 'http://localhost:9004',
+                'use_path_style_endpoint' => true,
+                'credentials' => [
+                    'key'    => getenv('MINIO_ACCESS_KEY'),
+                    'secret' => getenv('MINIO_SECRET_KEY'),
+                ],
+            ]);
+
+            if(!$client->doesBucketExist('flowdat3')){
+                $client->createBucket(array('Bucket' => 'flowdat3'));
+            }
+
+            echo "Sending $fileName to Minio".PHP_EOL;
 
             $result = $client->putObject(array(
                 'Bucket' => 'flowdat3',
-                'Key'    =>  $file,
+                'Key'    =>  $fileName,
                 'SourceFile'   => $path
             ));
-            return $result['ObjectURL'];
+            return $fileName;
         }catch (\Exception $ex){
             throw new \Exception($ex->getMessage());
         }

+ 3 - 2
src/App/Listener/ExportListener.php

@@ -18,7 +18,7 @@ class ExportListener
 
     public function __construct()
     {
-        $this->connectionAMQP = new AMQPStreamConnection(getenv('HOST_AMQP'), getenv('PORT_AMQP'), getenv('USER_AMQP'), getenv('PASS_AMQP'));
+        $this->connectionAMQP = new AMQPStreamConnection(getenv('HOST_AMQP'), '5672', 'guest', 'guest');
         $this->channelAMQP = $this->connectionAMQP->channel();
     }
 
@@ -53,7 +53,7 @@ class ExportListener
             $notificationId = $msgBody['notificationId'];
 
             $notificationService = new NotificationService();
-            $notificationService->update($msgBody['endpointBase'], $notificationId, ['message' => 'Processing ONUs to export' ,'status' => NotificationEnum::PROCESSING], $headers);
+            $notificationService->update($msgBody['endpointBase'], $notificationId, ['message' => 'Procesando información para exportación' ,'status' => NotificationEnum::PROCESSING], $headers);
 
             $onuService = new OnuService();
             $onuService->exportOnus($msgBody, $headers, $notificationId);
@@ -74,6 +74,7 @@ class ExportListener
         try {
             $this->connectionAMQP->close();
         } catch (\Exception $e) {
+            echo $e->getMessage().PHP_EOL;
         }
     }
 }

+ 6 - 7
src/App/Service/OnuService.php

@@ -78,8 +78,7 @@ class OnuService
 
             $filePathS3 = '';
             if(is_file($filePath)){
-                $nomeClienteBucket = explode('.', $endpointBase)[1];
-                $filePathS3 = S3Factory::send($filePath, $fileName, $nomeClienteBucket);
+                $filePathS3 = S3Factory::send($filePath, $fileName);
             }
 
             unlink($filePath);
@@ -108,7 +107,7 @@ class OnuService
     public function getOnus($endpoint, $headers, $tenancyId){
         try {
             $page = 1;
-            $limit = 10;
+            $limit = 1000;
             $onus = [];
 
             $this->makeRequestAndInsertOnu($endpoint, $headers, $onus, $page, $limit, $tenancyId);
@@ -132,7 +131,7 @@ class OnuService
             $requestOnu = $this->requestService->get($this->requestService->buildUrl($endpoint, $params), $headers);
 
             if($requestOnu['statusCode'] != 200){
-                echo "Não é possivel fazer a requisição para as ONUs \n";
+                echo "Isn't possible to get a some ONUS \n";
                 return true;
             }
             $response = json_decode($requestOnu['response'], true);
@@ -157,7 +156,7 @@ class OnuService
 
     public function getClients($allClientsIds, $endpointBase, $headers){
         try{
-            $clientsIdsChunk = array_chunk($allClientsIds, 10);
+            $clientsIdsChunk = array_chunk($allClientsIds, 1000);
             $clients = [];
 
             $qtdClientsPage = count($clientsIdsChunk);
@@ -174,7 +173,7 @@ class OnuService
 
                 $requestClients = $this->requestService->get($url, $headers);
                 if($requestClients['statusCode'] != 200){
-                    echo "Não é possivel fazer a requisição para os clientes \n";
+                    echo "Isn't possible get the clients \n";
                     continue;
                 }
 
@@ -197,7 +196,7 @@ class OnuService
         echo "Updating notification with ID ".$notificationId.PHP_EOL;
         try {
             $this->notificationService->update($endpointBase, $notificationId, [
-                'message' => 'File finished process',
+                'message' => 'Finalizó la exportación de ONUs',
                 'hasFile' => true,
                 'file' => $filePathS3,
                 'status' => NotificationEnum::FINISHED