[ https://issues.apache.org/jira/browse/AMQ-9514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856290#comment-17856290 ]
Ondrej Mrekaj edited comment on AMQ-9514 at 6/19/24 2:47 PM: ------------------------------------------------------------- Here is an connection example: {code:java} import asyncio import websockets import base64async def subscribe_and_send(): url = "ws://<HOST>:<PORT>" username = "username" password = "password" async with websockets.connect(url, subprotocols=['stomp', 'ISYSUB']) as websocket: print("Connected to WebSocket") connect_frame = ( f"CONNECT\n" f"accept-version:1.2\n" f"host:localhost\n" f"login:{username}\n" f"passcode:{password}\n\n\x00" ) await websocket.send(connect_frame) response = await websocket.recv() print(f"Received CONNECT response: {response}") if 'CONNECTED' not in response: print("Failed to connect") return # Subscribe to the queue subscribe_frame = "SUBSCRIBE\nid:sub-0\ndestination:/queue/FOO?consumer.exclusive=true\n\n\x00" await websocket.send(subscribe_frame) print("Subscribed to queue") message = "Hello!" send_frame = f"SEND\ndestination:/queue/FOO\ncontent-length:{len(message)}\n\n{message}\x00" await websocket.send(send_frame) print(f"Sent message: {message}") while True: incoming_message = await websocket.recv() print(f"Received message: {incoming_message}")asyncio.get_event_loop().run_until_complete(subscribe_and_send()) {code} The {{subscribe_frame}} includes {*}{{?consumer.exclusive=true}}{*}, but it is not being applied. was (Author: JIRAUSER294523): Here is an connection example: {code:java} import asyncio import websockets import base64async def subscribe_and_send(): url = "ws://<HOST>:<PORT>" username = "username" password = "password" async with websockets.connect(url, subprotocols=['stomp', 'ISYSUB']) as websocket: print("Connected to WebSocket") # Send the CONNECT frame with username and password to establish the connection connect_frame = ( f"CONNECT\n" f"accept-version:1.2\n" f"host:localhost\n" f"login:{username}\n" f"passcode:{password}\n\n\x00" ) await websocket.send(connect_frame) response = await websocket.recv() print(f"Received CONNECT response: {response}") # Check if connection was successful if 'CONNECTED' not in response: print("Failed to connect") return # Subscribe to the queue subscribe_frame = "SUBSCRIBE\nid:sub-0\ndestination:/queue/FOO?consumer.exclusive=true\n\n\x00" await websocket.send(subscribe_frame) print("Subscribed to queue") # Send a message to the queue message = "Hello, World!" send_frame = f"SEND\ndestination:/queue/FOO\ncontent-length:{len(message)}\n\n{message}\x00" await websocket.send(send_frame) print(f"Sent message: {message}") while True: # Receive and print messages from the queue incoming_message = await websocket.recv() print(f"Received message: {incoming_message}")asyncio.get_event_loop().run_until_complete(subscribe_and_send()) {code} The {{subscribe_frame}} includes {*}{{?consumer.exclusive=true}}{*}, but it is not being applied. > How to set exclusive consumer for ws connector? > ----------------------------------------------- > > Key: AMQ-9514 > URL: https://issues.apache.org/jira/browse/AMQ-9514 > Project: ActiveMQ Classic > Issue Type: Bug > Environment: ActiveMQ versions 5.15.3 and 5.18.3 > Reporter: Ondrej Mrekaj > Priority: Major > > Hello, > I attempted to edit the {{broker.xml}} file as follows: > {code:java} > <destinationPolicy> > <policyMap> > <policyEntries> > <policyEntry queue=">" allConsumersExclusiveByDefault="true"/> > </policyEntries> > </policyMap> > </destinationPolicy> {code} > Additionally, I modified the connection string by adding > {{{}?consumer.exclusive=true{}}}, so it now looks like this: > > {code:java} > wss://HOST:IP/queue/FOO?consumer.exclusive=true {code} > However, the {{Exclusive}} attribute is still being set to {{{}false{}}}. > What might be causing this issue? > I tried this configuration in ActiveMQ versions 5.15.3 and 5.18.3. The client > connects using the WebSocket protocol. > Thank you. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org For additional commands, e-mail: issues-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact