Here it is:
#!/usr/bin/env python
import optparse
import proton
import sys
def main():
parser = optparse.OptionParser('%prog [OPTS] MESSAGE')
parser.add_option('-a', '--address', default='amqp://zhigang1',
help='adress:
[amqp[s]://][user[:password]@]domain[/[name]]')
parser.add_option('-s', '--subject', default='foo.bar',
help='subject')
opts, args = parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
messenger = proton.Messenger()
messenger.start()
msg = proton.Message()
msg.address = opts.address
msg.subject = opts.subject
content = ' '.join(args)
msg.body = unicode(content)
messenger.put(msg)
messenger.send()
messenger.stop()
if __name__ == '__main__':
main()
On Wed, Jan 23, 2013 at 9:20 AM, Zhigang Wang <[email protected]> wrote:
> Here it is:
>
>
> On Wed, Jan 23, 2013 at 8:52 AM, Hiram Chirino <[email protected]>wrote:
>
>> Seems like your attachment is not being preserved on the mailing list,
>> could you just include it inline?
>>
>>
>> On Tue, Jan 22, 2013 at 2:00 PM, Zhigang Wang <[email protected]> wrote:
>>
>> > Sorry. It seems I forget to attach my script. Here it is. I modified it
>> > from the proton example. Then what is the right way to disconnect
>> cleanly?
>> >
>> >
>> > On Tue, Jan 22, 2013 at 1:27 PM, Hiram Chirino <[email protected]
>> >wrote:
>> >
>> >> This just means your client did not gracefully disconnect from the
>> broker.
>> >> It should be fine to ignore.
>> >>
>> >>
>> >> On Tue, Jan 22, 2013 at 12:00 PM, Zhigang Wang <[email protected]>
>> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > When I send a message using proton-python (script attached), it will
>> >> > generate a warning:
>> >> >
>> >> > INFO | jvm 1 | 2013/01/22 11:48:39 | WARN | Transport
>> Connection
>> >> to:
>> >> > tcp://10.149.236.110:36301 failed: java.io.EOFException
>> >> >
>> >> > client side:
>> >> >
>> >> > ./send.py -a amqp://zhigang1/TEST.FOO "hello2 from zhigang"
>> >> >
>> >> > But it seems this warning will not prevent this message from getting
>> to
>> >> my
>> >> > JMS receiver.
>> >> >
>> >> > Please confirm: if it's harmless, I think we should catch this
>> >> exception;
>> >> > if not, please help to fix it.
>> >> >
>> >> > Let me know if you need more info.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Zhigang
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >> **
>> >>
>> >> *Hiram Chirino*
>> >>
>> >> *Engineering | Red Hat, Inc.*
>> >>
>> >> *[email protected] <[email protected]> | fusesource.com |
>> redhat.com*
>> >>
>> >> *skype: hiramchirino | twitter: @hiramchirino<
>> >> http://twitter.com/hiramchirino>
>> >> *
>> >>
>> >> *blog: Hiram Chirino's Bit Mojo <http://hiramchirino.com/blog/>*
>> >>
>> >
>> >
>>
>>
>> --
>>
>> **
>>
>> *Hiram Chirino*
>>
>> *Engineering | Red Hat, Inc.*
>>
>> *[email protected] <[email protected]> | fusesource.com | redhat.com*
>>
>> *skype: hiramchirino | twitter: @hiramchirino<
>> http://twitter.com/hiramchirino>
>> *
>>
>> *blog: Hiram Chirino's Bit Mojo <http://hiramchirino.com/blog/>*
>>
>
>