ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class AsyncTestData
|
||||
{
|
||||
/**
|
||||
* @var $msgValue
|
||||
*/
|
||||
protected $msgValue;
|
||||
|
||||
/**
|
||||
* @var $path
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* set path to tmp directory.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
public function setTextFilePath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTextFilePath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $strValue
|
||||
* @return void
|
||||
*/
|
||||
public function setValue($strValue)
|
||||
{
|
||||
$this->msgValue = $strValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->msgValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class CustomHandler
|
||||
{
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function process($simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'custom-string-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData[] $simpleDataItems
|
||||
*/
|
||||
public function processArray($simpleDataItems)
|
||||
{
|
||||
foreach ($simpleDataItems as $objItem) {
|
||||
file_put_contents(
|
||||
$objItem->getTextFilePath(),
|
||||
'custom-array-' . $objItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $simpleDataItems
|
||||
*/
|
||||
public function processMixed($simpleDataItems)
|
||||
{
|
||||
/** @var AsyncTestData[] $simpleDataItems */
|
||||
$simpleDataItems = is_array($simpleDataItems) ? $simpleDataItems : [$simpleDataItems];
|
||||
foreach ($simpleDataItems as $simpleDataItem) {
|
||||
if (!($simpleDataItem instanceof AsyncTestData)) {
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'Invalid data item given. Was expected instance of ' . AsyncTestData::class . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
continue;
|
||||
}
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'custom-mixed-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class RequestHandler
|
||||
{
|
||||
/**
|
||||
* @param \Magento\TestModuleAsyncAmqp\Model\AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function process($simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'InvokedFromRequestHandler-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class WildCardHandler
|
||||
{
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodOne(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodOne - wildcard.queue.one - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodTwo(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodTwo - wildcard.queue.two - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodThree(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodThree - wildcard.queue.three - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodFour(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodFour - wildcard.queue.four - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
|
||||
<topic name="multi.topic.queue.topic.c.deprecated" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="multi.topic.queue.topic.d.deprecated" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="multi.topic.queue.topic.c" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="multi.topic.queue.topic.d" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="multi.topic.queue.topic.y" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqC" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="multi.topic.queue.topic.z" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="processAsyncReqD" type="Magento\TestModuleAsyncAmqp\Model\RequestHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="mtmh.topic.1" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData">
|
||||
<handler name="mtmh.handler.1" type="Magento\TestModuleAsyncAmqp\Model\CustomHandler" method="process"/>
|
||||
</topic>
|
||||
<topic name="mtmh.topic.2" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData[]">
|
||||
<handler name="mtmh.handler.2" type="Magento\TestModuleAsyncAmqp\Model\CustomHandler" method="processArray"/>
|
||||
</topic>
|
||||
|
||||
<topic name="segment1.segment2.segment3.wildcard" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
|
||||
<topic name="segment2.segment3.wildcard" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
|
||||
<topic name="not.matching.wildcard.topic" request="Magento\TestModuleAsyncAmqp\Model\AsyncTestData"/>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleAsyncAmqp" />
|
||||
</config>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd">
|
||||
<broker topic="multi.topic.queue.topic.c.deprecated" type="amqp" exchange="magento">
|
||||
<queue consumer="queue.for.multiple.topics.test.c.deprecated" name="queue.for.multiple.topics.test.c.deprecated"/>
|
||||
<queue consumer="mixed.sync.and.async.queue.consumer.deprecated" name="mixed.sync.and.async.queue.deprecated"/>
|
||||
</broker>
|
||||
<broker topic="multi.topic.queue.topic.d.deprecated" type="amqp" exchange="magento">
|
||||
<queue consumer="queue.for.multiple.topics.test.d.deprecated" name="queue.for.multiple.topics.test.d.deprecated"/>
|
||||
</broker>
|
||||
</config>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<!--<?xml version="1.0"?>-->
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
|
||||
<consumer name="queue.for.multiple.topics.test.c" queue="queue.for.multiple.topics.test.c"/>
|
||||
<consumer name="queue.for.multiple.topics.test.d" queue="queue.for.multiple.topics.test.d"/>
|
||||
<consumer name="queue.for.multiple.topics.test.y" queue="queue.for.multiple.topics.test.y" connection="amqp"/>
|
||||
<consumer name="queue.for.multiple.topics.test.z" queue="queue.for.multiple.topics.test.z" connection="amqp"/>
|
||||
<consumer name="mixed.sync.and.async.queue.consumer" connection="amqp" queue="mixed.sync.and.async.queue"/>
|
||||
<consumer name="mtmh.queue.1.consumer" queue="mtmh.queue.1" connection="amqp" handler="Magento\TestModuleAsyncAmqp\Model\CustomHandler::processMixed"/>
|
||||
<consumer name="mtmh.queue.2.consumer" queue="mtmh.queue.2" connection="amqp"/>
|
||||
<consumer name="wildcard.queue.one.consumer" connection="amqp" queue="wildcard.queue.one" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodOne"/>
|
||||
<consumer name="wildcard.queue.two.consumer" connection="amqp" queue="wildcard.queue.two" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodTwo"/>
|
||||
<consumer name="wildcard.queue.three.consumer" connection="amqp" queue="wildcard.queue.three" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodThree"/>
|
||||
<consumer name="wildcard.queue.four.consumer" connection="amqp" queue="wildcard.queue.four" handler="Magento\TestModuleAsyncAmqp\Model\WildCardHandler::methodFour"/>
|
||||
</config>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!--<?xml version="1.0"?>-->
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
|
||||
<publisher topic="multi.topic.queue.topic.c">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="multi.topic.queue.topic.d">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="multi.topic.queue.topic.y">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="multi.topic.queue.topic.z">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="mtmh.topic.1">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="mtmh.topic.2">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="segment1.segment2.segment3.wildcard">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="segment2.segment3.wildcard">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
<publisher topic="not.matching.wildcard.topic">
|
||||
<connection name="amqp" exchange="magento" />
|
||||
</publisher>
|
||||
</config>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
|
||||
<exchange name="magento" connection="amqp" type="topic">
|
||||
<binding id="async.binding1" topic="multi.topic.queue.topic.c" destinationType="queue" destination="queue.for.multiple.topics.test.c"/>
|
||||
<binding id="async.binding2" topic="multi.topic.queue.topic.c" destinationType="queue" destination="mixed.sync.and.async.queue"/>
|
||||
<binding id="async.binding3" topic="multi.topic.queue.topic.d" destinationType="queue" destination="queue.for.multiple.topics.test.d"/>
|
||||
<binding id="async.binding4" topic="mtmh.topic.1" destinationType="queue" destination="mtmh.queue.1"/>
|
||||
<binding id="async.binding5" topic="mtmh.topic.1" destinationType="queue" destination="mtmh.queue.2"/>
|
||||
<binding id="async.binding6" topic="mtmh.topic.2" destinationType="queue" destination="mtmh.queue.1"/>
|
||||
<binding id="async.binding7" topic="mtmh.topic.2" destinationType="queue" destination="mtmh.queue.2"/>
|
||||
<binding id="async.binding8" topic="multi.topic.queue.topic.y" destinationType="queue" destination="queue.for.multiple.topics.test.y"/>
|
||||
<binding id="async.binding9" topic="multi.topic.queue.topic.z" destinationType="queue" destination="queue.for.multiple.topics.test.z"/>
|
||||
|
||||
<binding id="wildCardBinding1" topic="#.wildcard" destinationType="queue" destination="wildcard.queue.one"/>
|
||||
<binding id="wildCardBinding2" topic="*.*.segment3.wildcard" destinationType="queue" destination="wildcard.queue.two"/>
|
||||
<binding id="wildCardBinding3" topic="*.segment3.wildcard" destinationType="queue" destination="wildcard.queue.three"/>
|
||||
<binding id="wildCardBinding4" topic="#.segment3.*" destinationType="queue" destination="wildcard.queue.four"/>
|
||||
</exchange>
|
||||
</config>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleAsyncAmqp') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleAsyncAmqp', __DIR__);
|
||||
}
|
||||
Reference in New Issue
Block a user