[
https://issues.apache.org/jira/browse/PROTON-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17105781#comment-17105781
]
Angelo Mendonca commented on PROTON-2218:
-----------------------------------------
{code:java}
from proton.handlers import MessagingHandler
from proton.reactor import Container
from proton import Message
import jsonclass FailOverHandler(MessagingHandler):
def __init__(self, url_one, url_two, queue, message):
super(FailOverHandler, self).__init__()
self.url_one = url_one
self.url_two = url_two
self.queue = queue
self.sender = None
self.conn = None
self.message = message
self.count = 0 def on_sendable(self, event):
print("On Sendable")
self.send() def on_connection_error(self,event):
print(event)
event.connection.close()
def on_transport_error(self, event):
print(event)
event.connection.close()
print(event.transport.condition) def send(self):
while self.sender.credit and self.count < 200:
body = json.dumps(self.message)
self.sender.send(Message(durable=True, body=body))
self.count +=1
print("Sent message") def on_accepted(self, event):
print("Accepted")
event.connection.close() def on_start(self, event):
print("Starting")
self.conn = event.container.connect(urls=[self.url_one, self.url_two],
address=self.queue,
sasl_enabled=True,
allow_insecure_mechs=False,password='DFfoSQM2ZYlLqCLm',
user='DsWPjfKALYgKmtwsVGHBceceygn', reconnect=True)
self.conn.state
print("Creating Sender")
self.sender = event.container.create_sender(self.conn,
self.queue)url_one='amqps://b-4655a180-9a2d-4c67-99aa-bbe51f58b963-1.mq.us-east-1.amazonaws.com:5671'
url_two='amqps://b-4655a180-9a2d-4c67-99aa-bbe51f58b963-2.mq.us-east-1.amazonaws.com:5671'
hdl=FailOverHandler(url_one,url_two,'test', '{"Name":"Test Data"}')
c=Container(hdl)
c.run()
{code}
> Connector.user and Connector.Password are None
> ----------------------------------------------
>
> Key: PROTON-2218
> URL: https://issues.apache.org/jira/browse/PROTON-2218
> Project: Qpid Proton
> Issue Type: Bug
> Components: python-binding
> Affects Versions: proton-c-0.30.0
> Reporter: Angelo Mendonca
> Assignee: Jiri Daněk
> Priority: Major
> Attachments: image-2020-05-12-14-18-33-313.png,
> image-2020-05-12-17-01-10-260.png, jd_answer_1.png
>
>
>
> {noformat}
> connector.user = kwargs.get('user', self.user)
> print("User", kwargs.get('user', self.user))
> print(connector.user)
> connector.password = kwargs.get('password', self.password)
> print("password", kwargs.get('password', self.password))
> print(connector.password){noformat}
> [https://github.com/apache/qpid-proton/blob/4265cc7ab8391630b47da2de4c1ead2f28763980/python/proton/_reactor.py#L1264]
>
> [https://github.com/apache/qpid-proton/blob/4265cc7ab8391630b47da2de4c1ead2f28763980/python/proton/_reactor.py#L1265]
>
> Dont see to exist in kwargs although the print statement just above the
> kwargs.get shows that user and password exist...
> The output is below..
>
> {code:java}
> KWARGS {'kwargs': {'sasl_enabled': True, 'allow_insecure_mechs': True,
> 'password': 'DFfoSQM2ZYlLqCLm', 'user': 'DsWPjfKALYgKmtwsVGHBceceygn'}}
> User None
> None
> password None
> None
> {code}
>
> The Code setups a container connection..
> !image-2020-05-12-14-18-33-313.png!
>
> No idea why the user and password are not being set although kwagrs contains
> both the keys....I am trying to get failover to work with AWS Amazon MQ. Does
> BlockingConnection let you work with multiple URLS? Or do I need to use
> "container.connect"?
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]