[openamq-dev] openamq-dev Digest, Vol 6, Issue 13

Malinga malingajava at yahoo.com
Fri Aug 17 11:53:49 CEST 2007


HI i just check your program it works but im really sorry,

My data structure is 
struct MontageDataStructure{
    int     SIDE;
    std::string     EXCHANGE;
    std::string     SYMBOLE;
    int     SHARES;
    double     STRIKE_PRICE;            
};

Pls can you tell me how to encode this thing in the wire. Im so sorry i know this is not relating to middleware. Pls help me on this.

Thanks in adavance.
-Malinga

----- Original Message ----
From: "openamq-dev-request at lists.openamq.org" <openamq-dev-request at lists.openamq.org>
To: openamq-dev at lists.openamq.org
Sent: Friday, August 17, 2007 7:48:21 AM
Subject: openamq-dev Digest, Vol 6, Issue 13

Send openamq-dev mailing list submissions to
    openamq-dev at lists.openamq.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://lists.openamq.org/mailman/listinfo/openamq-dev
or, via email, send a message with subject or body 'help' to
    openamq-dev-request at lists.openamq.org

You can reach the person managing the list at
    openamq-dev-owner at lists.openamq.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of openamq-dev digest..."


Today's Topics:

   1. Help on receving Vector objects (Malinga)
   2. Re: Help on receving Vector objects (Martin Sustrik)
   3. Re: porting to Ubuntu (Martin Sustrik)
   4. Re: Help on Openamq required (Martin Sustrik)
   5. Urgent help required (mousami lokapur)
   6. Re: porting to Ubuntu (Nick Levine)
   7. Re: porting to Ubuntu (Jonathan Schultz)


----------------------------------------------------------------------

Message: 1
Date: Thu, 16 Aug 2007 04:16:29 -0700 (PDT)
From: Malinga <malingajava at yahoo.com>
Subject: [openamq-dev] Help on receving Vector objects
To: openamq-dev at lists.openamq.org
Message-ID: <525377.7950.qm at web30912.mail.mud.yahoo.com>
Content-Type: text/plain; charset="us-ascii"

Hi,

    I manage to successful send the message with the help of Martin Sustrik, thanks for that. But now i want to retrieve it. im using, 

[
message_size = amq_content_basic_get_body (content, (byte*)message_text, 1024);

    if (message_size) {
        message_text [message_size] = 0;
        icl_console_print("INFO : ");
        icl_console_print (message_text);    
        std::vector<MontageDataStructure>* vec = (std::vector<MontageDataStructure>*) message_text;

        printf("SIZE %d \n", vec->size());

            for(int i=0;i<vec->size();i++){
                printf("Side     :  %d  \n", vec->at(i).A);
                printf("Exchange     :  %s  \n", vec->at(i).B);
                printf("Symbole     :  %s  \n", vec->at(i).C);
                printf("Shares     :  %d  \n", vec->at(i).D);
                printf("Price     :  %d  \n", vec->at(i).E);
            }    
]


   To retrieve the message. But it fails and send me the wrong outputs, what i have done wrong pls guide me.

Thanks in advance.

-Malinga




       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openamq.org/pipermail/openamq-dev/attachments/20070816/a75760f4/attachment-0001.htm 

------------------------------

Message: 2
Date: Thu, 16 Aug 2007 14:27:00 +0200
From: Martin Sustrik <sustrik at imatix.com>
Subject: Re: [openamq-dev] Help on receving Vector objects
To: "OpenAMQ development discussion, bug reports,    support"
    <openamq-dev at lists.openamq.org>
Message-ID: <46C44294.60700 at imatix.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Malinga,

Hard to say, depends on how the MotageDataStructure-s are encoded 
on-the-wire. You have to choose binary format for them, make sender 
transform individual structures in the vector into the binary format and 
receiver to parse the structures from the binary format and push them 
into the vector.

I believe you should read the STL specification/tutorial carefully as 
your problem is not related to OpenAMQ but to STL vectors.

To help you here's a way how to serialize vector of integers into a 
binary buffer:

void *save (const vector<int> &vec)
{
     int *buffer = (int*) malloc (sizeof (int) * vec.size ());
     for (int i = 0; i != vec.size (); i++)
         buffer [i] = vec [i];
     return (void*) buffer;
}

And to get integers from buffer to vector:

vector<int> load (void *buffer, size_t size)
{
     int *buf = (int*) buffer;
     size /= sizeof (int);
     vector<int> vec;
     for (int i = 0; i != size; i++)
         rec.push_back (buf [i]);
     return vec;
}

I hope the example helps.
Martin


------------------------------

Message: 3
Date: Thu, 16 Aug 2007 14:34:09 +0200
From: Martin Sustrik <sustrik at imatix.com>
Subject: Re: [openamq-dev] porting to Ubuntu
To: "OpenAMQ development discussion, bug reports,    support"
    <openamq-dev at lists.openamq.org>
Message-ID: <46C44441.6040904 at imatix.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hm...

What about PAL scripts? Do they connect OK? And what about simplistic 
code like the one below. Does it hand as well?

#include "asl.h"
#include "amq_client_connection.h"
#include "amq_client_session.h"

int main (int argc, char *argv [])
{
     amq_client_connection_t
         *connection;
     icl_longstr_t
         *auth_data;

     icl_system_initialise (argc, argv);
     auth_data  = amq_client_connection_auth_plain ("guest", "guest");
     connection = amq_client_connection_new (
         "localhost", "/", auth_data, "test", 0, 30000);
     amq_client_connection_destroy (&connection);
     icl_longstr_destroy (&auth_data);
     icl_system_terminate ();
     return 0;
}

Nick Levine wrote:
> Hi Martin,
> 
>    >    2. May you have a look at what are individual threads doing
>    >    (backtraces would be ideal) when the app hangs?
> 
>    [...]
> 
>    Run it under gdb (you have debug build anyway, so it shouldn't be
>    much work), use "info threads" to find what threads are running,
>    "thread X" to switch to thread X, and "bt" to print the backtrace
>    the current thread.
> 
> OK, here goes. Threads 1,2,3 belong to the application. The other five
> were created when I called amq_client_connection_new_()
> 
> (gdb) continue
> Continuing.
> [New Thread -1232266352 (LWP 27313)]
> [New Thread -1240659056 (LWP 27314)]
> [New Thread -1249051760 (LWP 27315)]
> [New Thread -1257444464 (LWP 27316)]
> [New Thread -1265837168 (LWP 27317)]
> 
> Program received signal SIGINT, Interrupt.
> 0xffffe410 in __kernel_vsyscall ()
> (gdb) info threads
>   8 Thread -1265837168 (LWP 27317)  0xffffe410 in __kernel_vsyscall ()
>   7 Thread -1257444464 (LWP 27316)  0xffffe410 in __kernel_vsyscall ()
>   6 Thread -1249051760 (LWP 27315)  0xffffe410 in __kernel_vsyscall ()
>   5 Thread -1240659056 (LWP 27314)  0xffffe410 in __kernel_vsyscall ()
>   4 Thread -1232266352 (LWP 27313)  0xffffe410 in __kernel_vsyscall ()
>   3 Thread -1210426480 (LWP 27291)  0xffffe410 in __kernel_vsyscall ()
>   2 Thread -1218819184 (LWP 27292)  0xffffe410 in __kernel_vsyscall ()
> * 1 Thread -1210206528 (LWP 27290)  0xffffe410 in __kernel_vsyscall ()
> (gdb) help info threads
> IDs of currently known threads.
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0x0804a8f6 in p_wait_for_stack_condition ()
> #3  0x200638ed in ?? ()
> #4  0x080607f8 in ?? ()
> #5  0xffffffff in ?? ()
> #6  0x00000004 in ?? ()
> #7  0x206922c8 in ?? ()
> #8  0xbfc88d68 in ?? ()
> #9  0x08049d50 in main ()
> (gdb) thread 2
> [Switching to thread 2 (Thread -1218819184 (LWP 27292))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0xb6ca46a7 in smt_wait (msecs=0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
> #3  0xb6ca5276 in smt_initialise () at smt_os_thread.c:1765
> #4  0xb6b7093e in amq_client_connection_new_ (file=0x805e060 "", line=0, host=0x805e030 "localhost", virtual_host=0x805e048 "/", auth_data=0x8075728, 
>     instance=0x805e050 "test", trace=3, timeout=10000) at amq_client_connection.c:1663
> #5  0x200638ed in ?? ()
> #6  0x0805e060 in ?? ()
> #7  0x00000000 in ?? ()
> (gdb) thread 3
> [Switching to thread 3 (Thread -1210426480 (LWP 27291))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7ea43d1 in select () from /lib/tls/i686/cmov/libc.so.6
> #2  0x200638ed in ?? ()
> #3  0x00000000 in ?? ()
> (gdb) thread 4
> [Switching to thread 4 (Thread -1232266352 (LWP 27313))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7ea43d1 in select () from /lib/tls/i686/cmov/libc.so.6
> #2  0xb6b8afdb in apr_sleep (t=10000) at time/unix/time.c:246
> #3  0xb6ca3a4d in s_time_update (apr_thread=0x80657a0, data=0x0) at smt_os_thread.c:2759
> #4  0xb6b89606 in dummy_worker (opaque=0x80657a0) at threadproc/unix/thread.c:138
> #5  0xb7f2331b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #6  0xb7eab57e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb) thread 5
> [Switching to thread 5 (Thread -1240659056 (LWP 27314))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0xb6ca6442 in s_execute (apr_thread=0x8113cf8, data=0x80eb8e0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
> #3  0xb6b89606 in dummy_worker (opaque=0x8113cf8) at threadproc/unix/thread.c:138
> #4  0xb7f2331b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #5  0xb7eab57e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb) thread 6
> [Switching to thread 6 (Thread -1249051760 (LWP 27315))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0xb6ca6442 in s_execute (apr_thread=0x81456c8, data=0x811d2f0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
> #3  0xb6b89606 in dummy_worker (opaque=0x81456c8) at threadproc/unix/thread.c:138
> #4  0xb7f2331b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #5  0xb7eab57e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb) thread 7
> [Switching to thread 7 (Thread -1257444464 (LWP 27316))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0xb6ca6442 in s_execute (apr_thread=0x8177078, data=0x814eca0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
> #3  0xb6b89606 in dummy_worker (opaque=0x8177078) at threadproc/unix/thread.c:138
> #4  0xb7f2331b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #5  0xb7eab57e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb) thread 8
> [Switching to thread 8 (Thread -1265837168 (LWP 27317))]#0  0xffffe410 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
> #2  0xb6ca6442 in s_execute (apr_thread=0x81a8a28, data=0x8180650) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
> #3  0xb6b89606 in dummy_worker (opaque=0x81a8a28) at threadproc/unix/thread.c:138
> #4  0xb7f2331b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #5  0xb7eab57e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb) 
> 
> 
> 
> _______________________________________________
> openamq-dev mailing list
> openamq-dev at lists.openamq.org
> http://lists.openamq.org/mailman/listinfo/openamq-dev



------------------------------

Message: 4
Date: Thu, 16 Aug 2007 14:56:50 +0200
From: Martin Sustrik <sustrik at imatix.com>
Subject: Re: [openamq-dev] Help on Openamq required
To: "OpenAMQ development discussion, bug reports,    support"
    <openamq-dev at lists.openamq.org>
Message-ID: <46C44992.7080802 at imatix.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Mousami,

> As mentioned in my earlier mail i am following the sequence of first 
> sending message using sendtest.c which i have attached in my previous 
> mail and then trying to receive it. Also I am sending only 1 message and 
> not sending messages continuously using while loop.
> In this scenario the receive application that i am using should receive 
> this 1 message atleast?

If you want to recevie exactly 1 message, wait till it arrives, then 
retrieve it:

     amq_client_session_wait (session, -1);
     content = amq_client_session_arrived (session);

> Can you please give me im_send.pal since  the one which is provided in 
> the package(im_send.pal) is not generating .c code.

I am not sure about this problem. I have to check with my colleagues.

Martin


------------------------------

Message: 5
Date: Thu, 16 Aug 2007 18:28:27 +0530
From: "mousami lokapur" <mousami31 at hotmail.com>
Subject: [openamq-dev] Urgent help required
To: openamq-dev at lists.openamq.org
Message-ID: <BAY106-F8514A55D07124CF45481DACDF0 at phx.gbl>
Content-Type: text/plain; format=flowed


Hi,

1)
As mentioned in my earlier mail i am following the sequence of first sending
message using sendtest.c which i have attached in my previous mail and then
trying to receive it. Also I am sending only 1 message and not sending
messages continuously using while loop.
In this scenario the receive application that i am using should receive this
1 message atleast?

Please let me know if i have commited mistake in sendtest.c or in
mqreceive.c
This will help me run the sample codes and see the send/receive messages
functionality of Openamq.


2)
Can you please give me im_send.pal since  the one which is provided in the
package(im_send.pal) is not generating .c code.

Following error is generated :

[ samplecode]# pal im_send.pal

2007/06/24 23:21:36: gsl/4 M: <read> not allowed in repeat '1' in session
'1' in pal ''

Compiling im_send...

gcc: im_send.c: No such file or directory

gcc: no input files

E: compilation failed

3)
I also tried sample code that you have given at 
http://wiki.openamq.org/package:chatroom-example
but here too the receiver application i.e. im_receiver is not able to 
receive the message.

Please reply as we want to study the functionality of Openamq so that we can 
use it in our product.
Thanks
Mousami

_________________________________________________________________
Tried the new MSN Messenger? It’s cool! Download now. 
http://messenger.msn.com/Download/Default.aspx?mkt=en-in



------------------------------

Message: 6
Date: Thu, 16 Aug 2007 15:05:09 +0100 (BST)
From: Nick Levine <ndl at ravenbrook.com>
Subject: Re: [openamq-dev] porting to Ubuntu
To: Martin Sustrik <sustrik at imatix.com>
Cc: openamq-dev at lists.openamq.org
Message-ID: <200708161405.l7GE56tp084451 at raven.ravenbrook.com>

Martin,

Re: 

  (gdb) thread 2
  [Switching to thread 2 (Thread -1218819184 (LWP 27292))]#0  0xffffe410 in __kernel_vsyscall ()
  (gdb) bt
  #0  0xffffe410 in __kernel_vsyscall ()
  #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
  #2  0xb6ca46a7 in smt_wait (msecs=0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
  #3  0xb6ca5276 in smt_initialise () at smt_os_thread.c:1765
  #4  0xb6b7093e in amq_client_connection_new_ (file=0x805e060 "", line=0, host=0x805e030 "localhost", virtual_host=0x805e048 "/", auth_data=0x8075728, 
      instance=0x805e050 "test", trace=3, timeout=10000) at amq_client_connection.c:1663
  #5  0x200638ed in ?? ()
  #6  0x0805e060 in ?? ()
  #7  0x00000000 in ?? ()


Another data point: I put a breakpoint in smt_wait, started my
application (so it breaks in gdb), continued from the break, ... and
everything just worked. There's some sort of thread-locking going in
here...

Any thoughts?

- nick




------------------------------

Message: 7
Date: Fri, 17 Aug 2007 12:17:51 +1000
From: Jonathan Schultz <jonathan at imatix.com>
Subject: Re: [openamq-dev] porting to Ubuntu
To: "OpenAMQ development discussion, bug reports, support"
    <openamq-dev at lists.openamq.org>
Message-ID: <46C5054F.3090608 at imatix.com>
Content-Type: text/plain; charset=us-ascii; format=flowed

Nick,

Congratulations you seem to have stumbled on a hitherto undetected race 
condition in the SMT initialisation code.  I'll come up with a patch for 
you to try in a few hours.

Out of interest, can you tell us what hardware and kernel version you 
are using?

Regards,
Jonathan

Nick Levine wrote:
> Martin,
> 
> Re: 
> 
>   (gdb) thread 2
>   [Switching to thread 2 (Thread -1218819184 (LWP 27292))]#0  0xffffe410 in __kernel_vsyscall ()
>   (gdb) bt
>   #0  0xffffe410 in __kernel_vsyscall ()
>   #1  0xb7f275c6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
>   #2  0xb6ca46a7 in smt_wait (msecs=0) at /home/philip/wiinz/OpenAMQ-1.2c1/base-2.2b1/_install/include/icl.h:2014
>   #3  0xb6ca5276 in smt_initialise () at smt_os_thread.c:1765
>   #4  0xb6b7093e in amq_client_connection_new_ (file=0x805e060 "", line=0, host=0x805e030 "localhost", virtual_host=0x805e048 "/", auth_data=0x8075728, 
>       instance=0x805e050 "test", trace=3, timeout=10000) at amq_client_connection.c:1663
>   #5  0x200638ed in ?? ()
>   #6  0x0805e060 in ?? ()
>   #7  0x00000000 in ?? ()
> 
> 
> Another data point: I put a breakpoint in smt_wait, started my
> application (so it breaks in gdb), continued from the break, ... and
> everything just worked. There's some sort of thread-locking going in
> here...
> 
> Any thoughts?
> 
> - nick
> 
> 
> _______________________________________________
> openamq-dev mailing list
> openamq-dev at lists.openamq.org
> http://lists.openamq.org/mailman/listinfo/openamq-dev
> 
> 


------------------------------

_______________________________________________
openamq-dev mailing list
openamq-dev at lists.openamq.org
http://lists.openamq.org/mailman/listinfo/openamq-dev


End of openamq-dev Digest, Vol 6, Issue 13
******************************************







       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openamq.org/pipermail/openamq-dev/attachments/20070817/88e74fa3/attachment-0001.htm 


More information about the openamq-dev mailing list