当前位置: 首页>>代码示例>>Java>>正文


Java Jackson2JsonMessageConverter类代码示例

本文整理汇总了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;
}
 
开发者ID:laidu,项目名称:java-learn,代码行数:20,代码来源:JsonApp.java

示例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();
}
 
开发者ID:joshlong,项目名称:cloudfoundry-ftp-service-broker,代码行数:25,代码来源:Application.java

示例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;
}
 
开发者ID:giovannicandido,项目名称:audit-mq-collector,代码行数:9,代码来源:RabbitConfiguration.java

示例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;
}
 
开发者ID:giovannicandido,项目名称:audit-mq-collector,代码行数:8,代码来源:RabbitConfiguration.java

示例5: jsonMessageConverter

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonMessageConverter()
{
    final Jackson2JsonMessageConverter converter = new Jackson2JsonMessageConverter();
    converter.setClassMapper(classMapper());
    return converter;
}
 
开发者ID:microservices-demo,项目名称:queue-master,代码行数:8,代码来源:RabbitMqConfiguration.java

示例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);

}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:28,代码来源:AmqpMessageDispatcherServiceTest.java

示例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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:16,代码来源:AmqpMessageHandlerServiceTest.java

示例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;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:9,代码来源:AbstractAmqpIntegrationTest.java

示例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;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:10,代码来源:AmqpTestConfiguration.java

示例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;
}
 
开发者ID:ctco,项目名称:cukes,代码行数:16,代码来源:RabbitMQConfiguration.java

示例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;
}
 
开发者ID:ctco,项目名称:cukes,代码行数:9,代码来源:RabbitMQConfiguration.java

示例12: jackson2JsonMessageConverter

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
Jackson2JsonMessageConverter jackson2JsonMessageConverter() {
	return new Jackson2JsonMessageConverter();
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:5,代码来源:CommentService.java

示例13: producerJackson2MessageConverter

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public Jackson2JsonMessageConverter producerJackson2MessageConverter() {
    return new Jackson2JsonMessageConverter();
}
 
开发者ID:capesonlee,项目名称:tangtang-spring-cloud,代码行数:5,代码来源:AmqpConfig.java

示例14: jsonConverter

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonConverter() {
    return new Jackson2JsonMessageConverter();
}
 
开发者ID:laidu,项目名称:java-learn,代码行数:5,代码来源:JsonApp.java

示例15: producerJackson2MessageConverter

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; //导入依赖的package包/类
@Bean
public Jackson2JsonMessageConverter producerJackson2MessageConverter() {
	return new Jackson2JsonMessageConverter();
}
 
开发者ID:TraineeSIIp,项目名称:PepSIIrup-2017,代码行数:5,代码来源:SenderSmsApplication.java


注:本文中的org.springframework.amqp.support.converter.Jackson2JsonMessageConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。