RabbitMQ Performance Tool - rabbitmq

I'm trying to use this tool (displaying the results in HTML)
https://github.com/rabbitmq/rabbitmq-perf-test/blob/master/html/README.md
trying to generate messages into topic exchange named: "MYXG.XYZ"
but i just get it into default direct exchange
my json is
cat spec-file.js
[{'name': 'AMQPe',
'type' :'simple',
'uri': 'amqp://guest:guest#192.168.127.23:5672',
'exchange-type': 'topic',
'exchange-name': 'MYXG.XYZ',
'routing-key':'#',
'variables': [{'name': 'min-msg-size', 'values': [3200]}],
'producer-rate-limit': 30000,
'params': [{
'time-limit': 100,
'producer-count': 4,
'consumer-count': 2
}]
}]
can you help?

Related

Getstream Chat Documentation for Attachments & Actions / How to make clickable predefined answers?

I am not able to find Stream Chat React-Native documentation for Actions or I am not using what I found correct :-)
I am able to find a message example like:
{
'text': 'Wonderful! Thanks for asking.',
'attachments': [
{
'type': 'form',
'title': 'Select your account',
'actions': [
{
'name': 'account',
'text': 'Checking',
'style': 'primary',
'type': 'button',
'value': 'checking'
},
{
'name': 'account',
'text': 'Saving',
'style': 'default',
'type': 'button',
'value': 'saving'
},
{
'name': 'account',
'text': 'Cancel',
'style': 'default',
'type': 'button',
'value': 'cancel'
}
]
}
]
}
Pushing this message result in a OK rendering in the client.
Image: Message in chat client
However, the React-Native client throws an error when clicking any of the 3 buttons.
The error I get is:
WARN Possible Unhandled Promise Rejection (id: 0):
Error: StreamChat error code 4: RunMessageAction failed with error: "invalid or disabled command ``"
I have found some references to documentation like this:
Actions in combination with attachments can be used to build commands.
But the link does not end up describing anything about Commands.
Anyone have any tip. E.g. like a link to some documentation describing how to make clickable predefined answers work? :-D

PySpark sql write dataFrame that has a json column to mysql JDBC

I am trying to bulk write a DataFrame to mysql JDBC database. I am using databricks/pyspark.sql to write the DataFrames to the table. This table has a column that accepts json data(binary data). I did transform the json object to a StructType with following structure:
json object structure and conversion to dataframe:
schema_dict = {'fields': [
{'metadata': {}, 'name': 'dict', 'nullable': True, 'type': {"containsNull": True, "elementType":{'fields': [
{'metadata': {}, 'name': 'y1', 'nullable': True, 'type': 'integer'},
{'metadata': {}, 'name': 'y2', 'nullable': True, 'type': 'integer'}
],"type": 'struct'}, "type": 'array'}}
], 'type': 'struct'}
cSchema = StructType([StructField("x1", IntegerType()),StructField("x2", IntegerType()),StructField("x3", IntegerType()),StructField("x4", TimestampType()), StructField("x5", IntegerType()), StructField("x6", IntegerType()),
StructField("x7", IntegerType()), StructField("x8", TimestampType()), StructField("x9", IntegerType()), StructField("x10", StructType.fromJson(schema_dict))])
df = spark.createDataFrame(parsedList,schema=cSchema)
The output dataframe:
df:pyspark.sql.dataframe.DataFrame
x1:integer
x2:integer
x3:integer
x4:timestamp
x5:integer
x6:integer
x7:integer
x8:timestamp
x9:integer
x10:struct
dict:array
element:struct
y1:integer
y2:integer
Now I am trying to write this dataframe to mysql table using the mysql table.
import urllib
from pyspark.sql import SQLContext
from pyspark.sql.functions import regexp_replace, col
sqlContext = SQLContext(sc)
sqlContext
driver = "org.mariadb.jdbc.Driver"
url = "jdbc:mysql://dburl?rewriteBatchedStatements=true"
trial = "dbname.tablename"
user = "dbuser"
password = "dbpassword"
properties = {
"user": user,
"password": password,
"driver": driver
}
df.write.jdbc(url=url, table=trial, mode="append", properties = properties)
I am getting this error:
An error occurred while calling o2118.jdbc.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 15 in stage 176.0 failed 4 times, most recent failure: Lost task 15.3 in stage 176.0 (TID 9528, 10.168.231.82, executor 5): java.lang.IllegalArgumentException: Can't get JDBC type for struct<dict:array<struct<y1:int,y2:int>>>
Any ideas on how to write a dataframe that has a json column to mysql table? or how to solve this issue?
I am using Databricks 5.5 LTS (includes Apache Spark 2.4.3, Scala 2.11)

How to store complex data in Redis?

I want to store data in the following style in Redis database:
{ _id: 5b3a60cdccbdf81bcc5343e6,
id: 5b3a60cdccbdf81bcc5343e5,
position: 'Web dveloper',
type: 'Contract',
Skills: 'html, bootstrap,php',
location: 'Boston',
job_id: 1,
Experience: '0-6 months',
Description: 'Developer for websites and web apps',
__v: 0 },
{ _id: 5b3a6151ccbdf81bcc5343e8,
id: 5b3a6151ccbdf81bcc5343e7,
position: 'Data analyst',
type: 'contract',
Skills: 'big data, hadoop,python',
location: 'boston',
job_id: 2,
Experience: '1yr',
Description: 'for analysing incoming data',
__v: 0 },
{ _id: 5b3a6207ccbdf81bcc5343ea,
id: 5b3a6207ccbdf81bcc5343e9,
position: 'Content Writer',
type: 'Permanent',
Skills: 'Technical wirtting,Custmer engagement',
location: 'new jersey',
job_id: 3,
Experience: '0-6 months',
Description: 'for writting website content',
__v: 0 },
{ _id: 5b3a62c4ccbdf81bcc5343ec,
id: 5b3a62c4ccbdf81bcc5343eb,
position: 'node js specialist',
type: 'Permanent',
Skills: 'node js ,express js , mean stack',
location: 'boston',
job_id: 4,
Experience: '1yr',
Description: 'for the web apps',
__v: 0 },
{ _id: 5b3a6362ccbdf81bcc5343ee,
id: 5b3a6362ccbdf81bcc5343ed,
position: 'database expert',
type: 'temporary',
Skills: 'sql , no sql, mysql,sql server,mongo db',
location: 'boston',
job_id: 5,
Experience: '2 yrs',
Description: 'for desinging and maintaing databases',
__v: 0 },
{ _id: 5b3a8639c8323b2cfc179969,
id: 5b3a8639c8323b2cfc179968,
position: 'Social media manager',
type: 'Permanent',
Skills: 'Social media marketing,Digital marketing',
location: 'Boston',
job_id: 4,
Experience: '1yr',
Description: 'For managing company socail media accounts',
__v: 0 }
I have gone through Redis official documentation but I have found nothing. Can anybody guide what structure I can use to store and how I can retrieve these data in table?
One of the alternatives you could use to store your data is the Redis Hash data structure. Using the Redis Hash structure, you could store your entities using the id as the key, then map the remaining fields into a Redis Hash using the HMSET command.
The recommended client for Node.js is the npm Redis package. This will provide all of the functionality you need to interact with Redis.
Ultimately, your query patterns are going to determine the optimal structure for your data. Using a hash is a very basic entity mapping approach to the problem, but it might not be the best way to structure the data. There may be more efficient ways to structure the data depending on how you plan to use it.
Redis doesn't offer that much structure directly, but there are layered libraries that do. I am trying to use Walrus, a Python library, that offers that capability atop Redis.

Getting store dump in Chrome/Firefox Javascript console?

I use a lot of Sencha stores in my app. Is there a way to dump them to the Javascript console in Chrome/Firefox so that I can quickly see what I have loaded in any given one while my app is running?
Ext.application({
name: 'Sencha',
models: ['One', 'Two', 'Three', ...],
stores: ['One', 'Two', 'Three', ...],
views: [...],
controllers: [...],
launch: function() {
Ext.Viewport.add(Ext.create('Sencha.view.MainView'));
}
});
You can use Ext.getStore:
Ext.getStore('One');
I suggest you take a look at the Ext.data.StoreManager. From there you can access each store you have created in your app.
Hope this helps

How to stop extjs treepanel from loading infinitely?

Finally after struggling with extjs tree panel, tree store and building custom reader to read and convert pentaho data for 2 weeks I have managed to load pentaho data into treepanel of extjs.
Now my Tree panel is loading same data infinitely.
Treepanel looks as follows :
Part of my json data looks as follows :
{
{name: 'US', candidateCount: 3, children: []},
{name: 'India', candidateCount: 922, children: [
{name: 'Goa', candidateCount:124, children: []},
{name: 'Maharashtra', candidateCount: 43, children: [
{name: 'Pune', candidateCount: 3},
{name: 'Mumbai', candidateCount: 33},
{name: 'Kolhapur', candidateCount: 4},
{name: 'XXX', candidateCount: 3},
]}
]},
{name: 'UK', candidateCount: 1, children: []},
}
As you can see in image above, after expanding India node it has again loaded data of country level (i.e. country names US, uk, India, UK). Actually I want to show state level data like data of Maharashtra, Goa. Instead of that treepanel is again loading same data again.
How to avoid this kind of behavior? I have already set leaf property of US, uk and India nodes to false.
I tried setting Expanded property to true but then treepanel keeps loading same nodes again and again and my browser tab just gets hanged.
Please let me know how to avoid this? I want tree panel to load data only once.
EDIT - Solution to this problem
I solved this problem by adding listener on append event of store and then setting leaf value to true for the nodes which I wanted to be leaf.
I had the same problem with my treepanel and JSON data. My treeStore looks something like this:
proxy: {
type: 'ajax',
url: 'urlJson',
reader: {
type: 'json',
root: 'instanceList',
successProperty: 'success'
}
},
root:{
text: 'Root',
expanded: true
}
And the JSON
{
"instanceList": [
{
"text": "Parent 1",
"instanceList": [
{
"class": "testing",
"id": 3,
"leaf": true,
"text": "Child 1"
}
]
},
{
"text": "Parent 2",
"instanceList": [
{
"class": "testing",
"id": 2,
"leaf": true,
"text": "Child 2"
},
{
"class": "testing",
"id": 1,
"leaf": true,
"text": "Child 3"
}
]
}
],
"instanceTotal": 1,
"success": true
}
I changed "children" for "instanceList" and my treepanel stopped doing that infinitely loop, so I guess If you change "name" for "children" ?
Setting data item to:
{
...
leaf: true
}
will stop it.
Loading trees can be tricking. Try setting loaded: true on those nodes. Before you start clicking around, is the tree properly loaded?
Make sure all parents that do not have any children have "leaf" set to "true" OR
have an empty "children" node.
AND all children nodes have "leaf" set to "true" (as already mentioned by Asken)
it seems to me that any child becomes a root to its dependents . So the root property and the children property MUST have the same NAME. I am very happy I found this tread. It saved my life I was about to shoot myself because of endless reloading the tree
As Edd said, if you set in proxy custom rootProperty:'instanceList', you have to change all "children" in json to that property, ie 'instanceList'. It was my solution.