<commit_before><?php
set_time_limit(0);

namespace app\commands;

use yii\console\Controller;

use yii\helpers\Json;
use yii\web\Response;
use PhpAmqpLib\Message\AMQPMessage;
use app\modules\api\models\Chat;

/**
* Webserver related functions
*/
class ChatworkerController extends Controller{
    public function actionIndex()
    {
		$queueName 		= "chat.message.user.db";
		$exchangeName 	= 'chat.message.exchange';
		$routingKey 	= 'chat.message.user.#';
		
		$connection = \Yii::$app->amqp->getConnection();
		$channel = $connection->channel();
		
		$channel->exchange_declare($exchangeName, 'topic', $passive=false, $durable=true, $auto_delete=false);
		$channel->queue_declare($queueName, $passive=false, $durable=true, $exclusive=false, $auto_delete=false);
		$channel->queue_bind($queueName, $exchangeName, $routingKey);

		$callback = function($msg){
			$body = JSON::decode($msg->body);
			$chat = new Chat();
			$chat->from_id 			= $body['from_id'];
			$chat->to_id 			= $body['to_id'];<commit_msg>chat message id added to API<commit_after><?php
namespace app\commands;

use yii\console\Controller;

use yii\helpers\Json;
use yii\web\Response;
use PhpAmqpLib\Message\AMQPMessage;
use app\modules\api\models\Chat;

/**
* Webserver related functions
*/
class ChatworkerController extends Controller{
    public function actionIndex()
    {
		set_time_limit(0);

		$queueName 		= "chat.message.user.db";
		$exchangeName 	= 'chat.message.exchange';
		$routingKey 	= 'chat.message.user.#';
		
		$connection = \Yii::$app->amqp->getConnection();
		$channel = $connection->channel();
		
		$channel->exchange_declare($exchangeName, 'topic', $passive=false, $durable=true, $auto_delete=false);
		$channel->queue_declare($queueName, $passive=false, $durable=true, $exclusive=false, $auto_delete=false);
		$channel->queue_bind($queueName, $exchangeName, $routingKey);

		$callback = function($msg){
			$body = JSON::decode($msg->body);
			$chat = new Chat();
			$chat->from_id 			= $body['from_id'];
			$chat->to_id 			= $body['to_id'];
{'fraction_non_alphanumeric': 0.16904176904176904, 'fraction_numerical': 0.0009828009828009828, 'mean_word_length': 5.095808383233533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6625102', 'n_tokens_mistral': 766, 'n_tokens_neox': 703, 'n_words': 120}