本文整理汇总了Java中org.springframework.amqp.support.converter.Jackson2JsonMessageConverter类的典型用法代码示例。如果您正苦于以下问题:Java Jackson2JsonMessageConverter类的具体用法?Java Jackson2JsonMessageConverter怎么用?Java Jackson2JsonMessageConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Jackson2JsonMessageConverter类属于org.springframework.amqp.support.converter包,在下文中一共展示了Jackson2JsonMessageConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: legacyPojoListener
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public SimpleMessageListenerContainer legacyPojoListener(ConnectionFactory connectionFactory) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
container.setQueueNames(MAPPED_QUEUE);
MessageListenerAdapter messageListener = new MessageListenerAdapter(new Object() {
@SuppressWarnings("unused")
public void handleMessage(Object object) {
System.out.println("Got a " + object);
JsonApp.this.latch.countDown();
}
});
Jackson2JsonMessageConverter jsonConverter = new Jackson2JsonMessageConverter();
jsonConverter.setClassMapper(classMapper());
messageListener.setMessageConverter(jsonConverter);
container.setMessageListener(messageListener);
return container;
}
示例2: amqpReplyFlow
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
IntegrationFlow amqpReplyFlow(ConnectionFactory rabbitConnectionFactory,
UserManager ftpUserManager) {
return IntegrationFlows.from(Amqp.inboundGateway(rabbitConnectionFactory, this.ftpRequests)
.messageConverter(new Jackson2JsonMessageConverter()))
.transform(String.class, new GenericTransformer<String, String>() {
@Override
public String transform(String source) {
try {
Map<String, String> map = toMap(source);
String ws = map.get("workspace");
String usr = map.get("user");
String password = UUID.randomUUID().toString();
FtpUser user = new FtpUser(ws, usr, password, true);
ftpUserManager.save(user);
String ftpUri = buildFtpConnectionString(host, port, user);
log.info("registering: workspace: " + ws + ", " + "user: " + usr + ", ftp URI: " + ftpUri);
return ftpUri;
} catch (FtpException e) {
throw new RuntimeException(e);
}
}
}).get();
}
示例3: jsonMessageConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public Jackson2JsonMessageConverter jsonMessageConverter(){
Jackson2JsonMessageConverter converter = new Jackson2JsonMessageConverter();
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
converter.setJsonObjectMapper(mapper);
return converter;
}
示例4: rabbitTemplate
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate rabbitTemplate(Jackson2JsonMessageConverter converter) {
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setRoutingKey(queueName);
template.setMessageConverter(converter);
return template;
}
示例5: jsonMessageConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonMessageConverter()
{
final Jackson2JsonMessageConverter converter = new Jackson2JsonMessageConverter();
converter.setClassMapper(classMapper());
return converter;
}
示例6: before
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Override
public void before() throws Exception {
super.before();
testTarget = targetManagement.create(entityFactory.target().create().controllerId(CONTROLLER_ID)
.securityToken(TEST_TOKEN).address(AMQP_URI.toString()));
this.rabbitTemplate = Mockito.mock(RabbitTemplate.class);
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
senderService = Mockito.mock(DefaultAmqpMessageSenderService.class);
final ArtifactUrlHandler artifactUrlHandlerMock = Mockito.mock(ArtifactUrlHandler.class);
when(artifactUrlHandlerMock.getUrls(anyObject(), anyObject()))
.thenReturn(Arrays.asList(new ArtifactUrl("http", "download", "http://mockurl")));
systemManagement = Mockito.mock(SystemManagement.class);
final TenantMetaData tenantMetaData = Mockito.mock(TenantMetaData.class);
when(tenantMetaData.getId()).thenReturn(TENANT_ID);
when(tenantMetaData.getTenant()).thenReturn(TENANT);
when(systemManagement.getTenantMetadata()).thenReturn(tenantMetaData);
amqpMessageDispatcherService = new AmqpMessageDispatcherService(rabbitTemplate, senderService,
artifactUrlHandlerMock, systemSecurityContext, systemManagement, targetManagement, serviceMatcher,
distributionSetManagement, softwareModuleManagement);
}
示例7: before
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Before
public void before() throws Exception {
messageConverter = new Jackson2JsonMessageConverter();
when(rabbitTemplate.getMessageConverter()).thenReturn(messageConverter);
when(artifactManagementMock.findFirstBySHA1(SHA1)).thenReturn(Optional.empty());
amqpMessageHandlerService = new AmqpMessageHandlerService(rabbitTemplate, amqpMessageDispatcherServiceMock,
controllerManagementMock, entityFactoryMock);
amqpMessageHandlerService = new AmqpMessageHandlerService(rabbitTemplate, amqpMessageDispatcherServiceMock,
controllerManagementMock, entityFactoryMock);
amqpAuthenticationMessageHandlerService = new AmqpAuthenticationMessageHandler(rabbitTemplate,
authenticationManagerMock, artifactManagementMock, downloadIdCache, hostnameResolverMock,
controllerManagementMock, tenantAwareMock);
}
示例8: createDmfClient
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
private RabbitTemplate createDmfClient() {
final RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setMessageConverter(new Jackson2JsonMessageConverter());
template.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
template.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
template.setExchange(getExchange());
return template;
}
示例9: rabbitTemplateForTest
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
@Primary
public RabbitTemplate rabbitTemplateForTest(ConnectionFactory connectionFactory) {
final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
rabbitTemplate.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
rabbitTemplate.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
return rabbitTemplate;
}
示例10: rabbitTemplate
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
RabbitTemplate rabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory cf,
ObjectMapper mapper) {
RabbitTemplate template = new RabbitTemplate(cf);
template.setExchange(EXCHANGE_NAME);
RetryTemplate retry = new RetryTemplate();
ExponentialBackOffPolicy backOff = new ExponentialBackOffPolicy();
backOff.setInitialInterval(1000);
backOff.setMultiplier(1.5);
backOff.setMaxInterval(60000);
retry.setBackOffPolicy(backOff);
template.setRetryTemplate(retry);
template.setMessageConverter(new Jackson2JsonMessageConverter(mapper));
return template;
}
示例11: rabbitListenerContainerFactory
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory cf,
ObjectMapper mapper) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(cf);
factory.setMessageConverter(new Jackson2JsonMessageConverter(mapper));
return factory;
}
示例12: jackson2JsonMessageConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
Jackson2JsonMessageConverter jackson2JsonMessageConverter() {
return new Jackson2JsonMessageConverter();
}
示例13: producerJackson2MessageConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public Jackson2JsonMessageConverter producerJackson2MessageConverter() {
return new Jackson2JsonMessageConverter();
}
示例14: jsonConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonConverter() {
return new Jackson2JsonMessageConverter();
}
示例15: producerJackson2MessageConverter
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public Jackson2JsonMessageConverter producerJackson2MessageConverter() {
return new Jackson2JsonMessageConverter();
}