Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

JMS for CPython via JPype?
Hello,

sorry for the potentially dumb question, but - would JPype make it possible
for a CPython program to use JMS? It seems that JMS is going to become a
standard for (java-based) MOM, so as an excellent middleware language it
should be possible for CPython to somehow "talk" (and understand) JMS...

TIA,

Best regards

Wolfgang Keller

Report this thread to moderator Post Follow-up to this message
Old Post
Wolfgang Keller
11-02-04 08:57 PM


Re: JMS for CPython via JPype?
Wolfgang Keller wrote:
> Hello,
>
> sorry for the potentially dumb question, but - would JPype make it possibl
e
> for a CPython program to use JMS? It seems that JMS is going to become a
> standard for (java-based) MOM, so as an excellent middleware language it
> should be possible for CPython to somehow "talk" (and understand) JMS...
>
> TIA,
>
> Best regards
>
> Wolfgang Keller

I am not very well versed in JMS, but unless it absolutely REQUIRE
subclassing, JPype will allow you to make full use for it without problem.

How to actually interpret the contents of the JMS message is left as an
exercise to the reader ;)

Steve


Report this thread to moderator Post Follow-up to this message
Old Post
Steve Menard
11-03-04 08:57 AM


Re: JMS for CPython via JPype?
Hello,

and thanks for your reply.
 

> I am not very well versed in JMS, but unless it absolutely REQUIRE
> subclassing, JPype will allow you to make full use for it without problem.
>
> How to actually interpret the contents of the JMS message is left as an
> exercise to the reader ;)

Err, does JPype not provide something for interfacing with Java like CTypes
provides it for interfacing with C? I.e. working with Java/C types in
Python as if they were Python variables?

TIA,

Regards

Wolfgang Keller

Report this thread to moderator Post Follow-up to this message
Old Post
Wolfgang Keller
11-04-04 08:58 PM


Re: JMS for CPython via JPype?
Wolfgang Keller wrote:
> Hello,
>
> and thanks for your reply.
>
> 
>
>
> 
>
>
> Err, does JPype not provide something for interfacing with Java like CType
s
> provides it for interfacing with C? I.e. working with Java/C types in
> Python as if they were Python variables?
>
> TIA,
>
> Regards
>
> Wolfgang Keller

Indeed it does. For the most part, Java classes can be used just like
regular Python classes.

What I meant is that JMS messages can contain just about ANYTHING.
Serialized Java classes, XML, plain text, etc ... Of course, if a
regular Java program cna generate/interptet the contents, A python+Jpype
program will be able to do it too. Again, with the same caveat that
JPype does not (yet) support subclassing Java classes in python.


Steve Menard

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Menard
11-05-04 08:57 PM


Re: JMS for CPython via JPype?
On Tue, 2 Nov 2004 18:19:25 +0100, Wolfgang Keller
<wolfgang.keller.nospam@gmx.de> wrote:

>Hello,
>
>sorry for the potentially dumb question, but - would JPype make it possible
>for a CPython program to use JMS? It seems that JMS is going to become a
>standard for (java-based) MOM, so as an excellent middleware language it
>should be possible for CPython to somehow "talk" (and understand) JMS...
>

Your question intrigued me, so I gave it a try. And the anwer (at
least for JMS Publish/Subscribe TextMessages) is YES.

The example I wrote is too long to include here, but you can get it at
http://home.comcast.net/~david.g.mo...r/Jpypejms.zip. It
includes:
- Java classes for a publisher (src/messaging/JpypePublisher) and a
subscriber (src/messaging/JpypeSubscriber). These Java classes, which
do most of the dirty work of connecting to the JMS server, are used
from python via jpype.
- Java classes that test the publisher and subscriber
(src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
- A Java interface that is used by python for the JProxy
- python scripts for publishing and subscribing
- An build.xml for ant to build and run the Java classes

The  Java and python publishers and subscribers work in any reasonable
combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
even with multiple subscribers)

Unzip to a conveniently located folder. You'll find a build.xml for
ant to build the Java. You'll have to edit (in the testers and in the
python scripts) the naming and connection factory stuff for your
situation. You'll also have to edit the python scripts to correctly
locate your jvm and other classpath information. Once you're correctly
configured, you can use ant to build and/or execute the Java (type
"ant help"). And once the Java is built, you can try the python
versions.

I can't imagine that this approach wouldn't work for JMS Queues. And
while I haven't tested it, I don't see anything preventing the use of
other message types (BinaryMessage, ObjectMessage,...).

BTW, I don't detect any noticable slowdown in the python versions from
the Java versions (probably because of the strightforward conversion
of python strings to Java Strings).

HTH,
Dave


Report this thread to moderator Post Follow-up to this message
Old Post
David Morgenthaler
11-06-04 08:56 AM


Re: JMS for CPython via JPype?
David Morgenthaler wrote:
> On Tue, 2 Nov 2004 18:19:25 +0100, Wolfgang Keller
> <wolfgang.keller.nospam@gmx.de> wrote:
>
> 
>
>
> Your question intrigued me, so I gave it a try. And the anwer (at
> least for JMS Publish/Subscribe TextMessages) is YES.
>
> The example I wrote is too long to include here, but you can get it at
> http://home.comcast.net/~david.g.mo...r/Jpypejms.zip. It
> includes:
> - Java classes for a publisher (src/messaging/JpypePublisher) and a
> subscriber (src/messaging/JpypeSubscriber). These Java classes, which
> do most of the dirty work of connecting to the JMS server, are used
> from python via jpype.
> - Java classes that test the publisher and subscriber
> (src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
> - A Java interface that is used by python for the JProxy
> - python scripts for publishing and subscribing
> - An build.xml for ant to build and run the Java classes
>
> The  Java and python publishers and subscribers work in any reasonable
> combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
> even with multiple subscribers)
>
> Unzip to a conveniently located folder. You'll find a build.xml for
> ant to build the Java. You'll have to edit (in the testers and in the
> python scripts) the naming and connection factory stuff for your
> situation. You'll also have to edit the python scripts to correctly
> locate your jvm and other classpath information. Once you're correctly
> configured, you can use ant to build and/or execute the Java (type
> "ant help"). And once the Java is built, you can try the python
> versions.
>
> I can't imagine that this approach wouldn't work for JMS Queues. And
> while I haven't tested it, I don't see anything preventing the use of
> other message types (BinaryMessage, ObjectMessage,...).
>
> BTW, I don't detect any noticable slowdown in the python versions from
> the Java versions (probably because of the strightforward conversion
> of python strings to Java Strings).
>
> HTH,
> Dave
>

Dave,

This example is amazing! would you be willing to contribute it to a
Jpype examples/recipe repository? I think such a place would be great
for those starting to use JPype. And as my documentation is not so good
(yet), good examples can only help.

Thanks.

Steve Menard

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Menard
11-06-04 08:56 PM


Re: JMS for CPython via JPype?
On Sat, 06 Nov 2004 13:19:49 -0500, Steve Menard <foo@bar.com> wrote:


>
>Dave,
>
>This example is amazing! would you be willing to contribute it to a
>Jpype examples/recipe repository? I think such a place would be great
>for those starting to use JPype. And as my documentation is not so good
>(yet), good examples can only help.
>
>Thanks.
>
>Steve Menard

Consider it contributed. I'm glad to (finally) give something back to
c.l.py!

Dave

Report this thread to moderator Post Follow-up to this message
Old Post
David Morgenthaler
11-06-04 08:56 PM


Re: JMS for CPython via JPype?
David Morgenthaler wrote:
> On Sat, 06 Nov 2004 13:19:49 -0500, Steve Menard <foo@bar.com> wrote:
>
>
> 
>
>
> Consider it contributed. I'm glad to (finally) give something back to
> c.l.py!
>
> Dave

Thank you very much!

I will add it to the exampels directyory for the next release.

Steve

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Menard
11-07-04 01:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Python archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:11 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.