简体   繁体   中英

crossbar.io container configuration, invalid attribute value 'component.python' for attribute 'type' in worker item

I try to configure a container worker by this config file:

 { "controller": { }, "workers": [ { "type": "router", "options": { "pythonpath": [".."] }, "realms": [ { "name": "realm1", "roles": [ { "name": "anonymous", "permissions": [ { "uri": "*", "publish": true, "subscribe": true, "call": true, "register": true } ] } ] } ], "transports": [ { "type": "web", "endpoint": { "type": "tcp", "port": 8080 }, "paths": { "/": { "type": "static", "directory": ".." }, "ws": { "type": "websocket" } } } ] }, { "type": "component.python", "class": "write_file.write_file.WriteFile", "router": { "type": "websocket", "endpoint": { "type": "tcp", "host": "localhost", "port": 8080 }, "url": "ws://localhost:8080/ws", "realm": "realm1" }, "options": { "pythonpath": [".."] } } ] } 

end I get:

"Error: invalid attribute value 'component.python' for attribute 'type' in worker item"

According to this , there should be a 'component.python' type of worker.

What is wrong with the config?

I'll appreciate any help.

As I was not able to find an answer, neither in the documentation nor on the internet, I tried to figure out how to set up the requested configuration by analyzing the source code of the crossbar checkconfig.py module.

In the end I got my class working by using the configuration below as an additional worker:

{
    "type" : "container", 
    "options" : {
        "pythonpath" : ["../"]
     }, 
    "components" : [{
            "type" : "class", 
            "classname" : "my/python/class", 
            "realm" : "realm1", 
            "transport" : {
                "type" : "websocket", 
                "endpoint" : {
                    "type" : "tcp", 
                    "host" : "localhost", 
                    "port" : 8080
                 }, 
                "url" : "ws://localhost:8080/ws"
             }
         }]
 }

Is this configuration working for you?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM