Skip to content

GH-3788 Support byte[] for JMS properties mapping #3789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,8 +57,9 @@
*/
public class DefaultJmsHeaderMapper extends JmsHeaderMapper {

private static final List<Class<?>> SUPPORTED_PROPERTY_TYPES = Arrays.asList(new Class<?>[]{
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class });
private static final List<Class<?>> SUPPORTED_PROPERTY_TYPES =
Arrays.asList(Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class,
String.class, byte[].class);


private static final Log LOGGER = LogFactory.getLog(DefaultJmsHeaderMapper.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,10 @@

import static org.assertj.core.api.Assertions.assertThat;

import jakarta.jms.JMSException;
import jakarta.jms.Message;
import jakarta.jms.TextMessage;

import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -43,11 +47,19 @@ public class JmsOutboundChannelAdapterTests extends ActiveMQMultiContextTests {
private JmsMessageDrivenEndpoint endpoint;

@Test
public void testTransactionalSend() {
public void testTransactionalSend() throws JMSException {
JmsTemplate template = new JmsTemplate(connectionFactory);
template.convertAndSend("outcatQ1", "Hello, world!");
template.send("outcatQ1",
session -> {
TextMessage textMessage =
session.createTextMessage("Hello, world!");
textMessage.setObjectProperty("bytesProperty", "testValue".getBytes());
return textMessage;
});
template.setReceiveTimeout(20000);
assertThat(template.receive("outcatQ2")).isNotNull();
Message receive = template.receive("outcatQ2");
assertThat(receive).isNotNull();
assertThat(receive.getObjectProperty("bytesProperty")).isEqualTo("testValue".getBytes());

this.aborter.abort = true;
template.convertAndSend("outcatQ1", "Hello, world!");
Expand Down