You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ben Amitai <Sa...@gmail.com> on 2008/12/02 10:37:25 UTC

Retrieving columns types with MapMessage

Hi,
I read a MapMessage object using Session.receive();
Now, I need to print the values of changed columns, but regarding to the
column's type.
for example, a date type should be read as long when name should be read as
string.

I have no information about the column's name..

Is what I want even possible?

thanx

udi
-- 
View this message in context: http://www.nabble.com/Retrieving-columns-types-with-MapMessage-tp20788846p20788846.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Retrieving columns types with MapMessage

Posted by Ben Amitai <Sa...@gmail.com>.


James.Strachan wrote:
> 
> 2008/12/2 Ben Amitai <Sa...@gmail.com>:
>>
>>
>>
>> James.Strachan wrote:
>>>
>>> 2008/12/2 Ben Amitai <Sa...@gmail.com>:
>>>>
>>>> Hi,
>>>> I read a MapMessage object using Session.receive();
>>>> Now, I need to print the values of changed columns, but regarding to
>>>> the
>>>> column's type.
>>>> for example, a date type should be read as long when name should be
>>>> read
>>>> as
>>>> string.
>>>>
>>>> I have no information about the column's name..
>>>>
>>>> Is what I want even possible?
>>>
>>> You can find the key names via
>>> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getMapNames()
>>>
>>> then ask for the value via
>>> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getObject(java.lang.String)
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://fusesource.com/
>>>
>>>
>>
>> Well, thats exactly what i'm doing, but, I really wished I could do
>> something like:
>> if typeof(key name) is timestamp then readLong.
>> otherwise readObject.
>>
>> The thing is I don't know the type...
> 
> Object value = getObject(key);
> if (value instanceof Date) { .... }
> else if (value instanceof Long) {... }
> 
> etc
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

Great! thanx...

-- 
View this message in context: http://www.nabble.com/Retrieving-columns-types-with-MapMessage-tp20788846p20789799.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Retrieving columns types with MapMessage

Posted by James Strachan <ja...@gmail.com>.
2008/12/2 Ben Amitai <Sa...@gmail.com>:
>
>
>
> James.Strachan wrote:
>>
>> 2008/12/2 Ben Amitai <Sa...@gmail.com>:
>>>
>>> Hi,
>>> I read a MapMessage object using Session.receive();
>>> Now, I need to print the values of changed columns, but regarding to the
>>> column's type.
>>> for example, a date type should be read as long when name should be read
>>> as
>>> string.
>>>
>>> I have no information about the column's name..
>>>
>>> Is what I want even possible?
>>
>> You can find the key names via
>> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getMapNames()
>>
>> then ask for the value via
>> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getObject(java.lang.String)
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>>
>
> Well, thats exactly what i'm doing, but, I really wished I could do
> something like:
> if typeof(key name) is timestamp then readLong.
> otherwise readObject.
>
> The thing is I don't know the type...

Object value = getObject(key);
if (value instanceof Date) { .... }
else if (value instanceof Long) {... }

etc

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Retrieving columns types with MapMessage

Posted by Ben Amitai <Sa...@gmail.com>.


James.Strachan wrote:
> 
> 2008/12/2 Ben Amitai <Sa...@gmail.com>:
>>
>> Hi,
>> I read a MapMessage object using Session.receive();
>> Now, I need to print the values of changed columns, but regarding to the
>> column's type.
>> for example, a date type should be read as long when name should be read
>> as
>> string.
>>
>> I have no information about the column's name..
>>
>> Is what I want even possible?
> 
> You can find the key names via
> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getMapNames()
> 
> then ask for the value via
> http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getObject(java.lang.String)
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

Well, thats exactly what i'm doing, but, I really wished I could do
something like:
if typeof(key name) is timestamp then readLong.
otherwise readObject.

The thing is I don't know the type...
-- 
View this message in context: http://www.nabble.com/Retrieving-columns-types-with-MapMessage-tp20788846p20789188.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Retrieving columns types with MapMessage

Posted by James Strachan <ja...@gmail.com>.
2008/12/2 Ben Amitai <Sa...@gmail.com>:
>
> Hi,
> I read a MapMessage object using Session.receive();
> Now, I need to print the values of changed columns, but regarding to the
> column's type.
> for example, a date type should be read as long when name should be read as
> string.
>
> I have no information about the column's name..
>
> Is what I want even possible?

You can find the key names via
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getMapNames()

then ask for the value via
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MapMessage.html#getObject(java.lang.String)

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/