That will only be true for applications using the core JMS client or the
OpenWire JMS client. If the client application is using the Qpid JMS client
it won't be a CoreMessage. It will be an AMQPMessage.

Regardless, it's always good to have such checks in place to confirm
expectations and deal with exceptions gracefully rather than assuming them
and risking some kind of breaking failure.


Justin

On Wed, Nov 30, 2022 at 10:06 AM John Lilley
<john.lil...@redpointglobal.com.invalid> wrote:

> I’ve verified it is indeed a CoreMessage
>
>
>
>
> [image: rg] <https://www.redpointglobal.com/>
>
> John Lilley
>
> Data Management Chief Architect, Redpoint Global Inc.
>
> 888 Worcester Street, Suite 200 Wellesley, MA 02482
>
> *M: *+1 7209385761 <+1%207209385761> | john.lil...@redpointglobal.com
>
> *From:* John Lilley <john.lil...@redpointglobal.com.INVALID>
> *Sent:* Wednesday, November 30, 2022 8:42 AM
> *To:* users@activemq.apache.org
> *Subject:* RE: JMS bytes vs Artemis CoreMessage bytes
>
>
>
> **** [Caution] This email is from an external source. Please use caution
> responding, opening attachments or clicking embedded links. ****
>
>
>
> Thanks Justin!
>
>
>
> If I send a JMS BytesMessage, should that end up being a CoreMessage in
> the server?
>
>
>
> john
>
>
>
>
>
> [image: rg]
> <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,HR3BXNxA_AN54I5go7bLBDNS8_Ow4YpGhKkXgNdbs0CAwSFA7HRIHuryB-cZ6z2DPGQGSkOsJWuBBmAb-Dxo2HrsaDAXjem-22EI3TcBmzD0&typo=1>
>
> *John Lilley *
>
> *Data Management Chief Architect, Redpoint Global Inc. *
>
> 888 Worcester Street, Suite 200 Wellesley, MA 02482
>
> *M: *+1 7209385761 <+1%207209385761> | john.lil...@redpointglobal.com
>
> *From:* Justin Bertram <jbert...@apache.org>
> *Sent:* Wednesday, November 30, 2022 8:33 AM
> *To:* users@activemq.apache.org
> *Subject:* Re: JMS bytes vs Artemis CoreMessage bytes
>
>
>
> **** [Caution] This email is from an external source. Please use caution
> responding, opening attachments or clicking embedded links. ****
>
>
>
> > First, is it correct to downcast to CoreMessage?
>
>
>
> Only if it actually is an instance of CoreMessage. I recommend you add an
> instanceof check to be sure.
>
>
>
> > Second, will the bytes be identical to the bytes I put into the JMS
> message, or will Artemis add some “framing” around it?
>
>
>
> The bytes should be the same as far as I can tell.
>
>
>
>
>
> Justin
>
>
>
> On Wed, Nov 30, 2022 at 8:10 AM John Lilley <
> john.lil...@redpointglobal.com.invalid> wrote:
>
> Greetings,
>
>
>
> I am trying to implement a logging ActiveMQServerPlugin that understands
> how to format the contents of our application messages.  But our clients
> are JMS and our client code makes JMS calls:
>
> BytesMessage m = session.createBytesMessage();
> m.writeBytes(bytes);
>
> When those packets are handled by our server plugin, and I do
>
> public void beforeSend(ServerSession session, Transaction tx, Message
> message, boolean direct, boolean noAutoCreateQueue) {
>
> var cm = (CoreMessage)message;
> var bytes = cm.getDataBuffer().byteBuf().array();
>
> First, is it correct to downcast to CoreMessage?
>
> Second, will the bytes be identical to the bytes I put into the JMS
> message, or will Artemis add some “framing” around it?
>
>
>
> Thanks
>
> John
>
>
>
>
>
> [image: rg]
> <https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.redpointglobal.com%2f&c=E,1,s5ofJlygW5HZHzL7eHUVj6qP2n2PVu0G3LDp5vmreZrk_HZN7XZgUxBfksTMAFccdtyzKVc_9GGVflXJKDcjUar0PVGA3G-1hWuoUuy_4_A2WLj-MnVLdY7hLUiV&typo=1>
>
> *John Lilley *
>
> *Data Management Chief Architect, Redpoint Global Inc. *
>
> 888 Worcester Street, Suite 200 Wellesley, MA 02482
>
> *M: *+1 7209385761 <+1%207209385761> | john.lil...@redpointglobal.com
>
>
> PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is
> confidential and is intended solely for the use of the individual(s) to
> whom it is addressed. If you believe you received this e-mail in error,
> please notify the sender immediately, delete the e-mail from your computer
> and do not copy, print or disclose it to anyone else. If you properly
> received this e-mail as a customer, partner or vendor of Redpoint, you
> should maintain its contents in confidence subject to the terms and
> conditions of your agreement(s) with Redpoint.
>
>
> PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is
> confidential and is intended solely for the use of the individual(s) to
> whom it is addressed. If you believe you received this e-mail in error,
> please notify the sender immediately, delete the e-mail from your computer
> and do not copy, print or disclose it to anyone else. If you properly
> received this e-mail as a customer, partner or vendor of Redpoint, you
> should maintain its contents in confidence subject to the terms and
> conditions of your agreement(s) with Redpoint.
>
> PLEASE NOTE: This e-mail from Redpoint Global Inc. (“Redpoint”) is
> confidential and is intended solely for the use of the individual(s) to
> whom it is addressed. If you believe you received this e-mail in error,
> please notify the sender immediately, delete the e-mail from your computer
> and do not copy, print or disclose it to anyone else. If you properly
> received this e-mail as a customer, partner or vendor of Redpoint, you
> should maintain its contents in confidence subject to the terms and
> conditions of your agreement(s) with Redpoint.
>

Reply via email to