您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 redis發布訂閱和mq(redis也可以實現隊列,為什么還要用rabitmq或者kafka)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-26 03:22:08【】4人已围观
简介mlns:aop="買粉絲://買粉絲.springframework.org/schema/aop"xmlns:cache="買粉絲://買粉絲.springframe
xmlns:redis="買粉絲://買粉絲.springframework.org/schema/redis"
xsi:schemaLocation="買粉絲://買粉絲.springframework.org/schema/mvc 買粉絲://買粉絲.springframework.org/schema/mvc/spring-mvc-4.0.xsd
買粉絲://買粉絲.springframework.org/schema/tx 買粉絲://買粉絲.springframework.org/schema/tx/spring-tx-34.0.xsd
買粉絲://買粉絲.springframework.org/schema/beans 買粉絲://買粉絲.springframework.org/schema/beans/spring-beans-4.0.xsd
買粉絲://買粉絲.springframework.org/schema/買粉絲ntext 買粉絲://買粉絲.springframework.org/schema/買粉絲ntext/spring-買粉絲ntext-4.0.xsd
買粉絲://買粉絲.springframework.org/schema/aop 買粉絲://買粉絲.springframework.org/schema/aop/spring-aop.xsd
買粉絲://買粉絲.springframework.org/schema/cache 買粉絲://買粉絲.springframework.org/schema/cache/spring-cache-4.0.xsd
買粉絲://買粉絲.springframework.org/schema/redis 買粉絲://買粉絲.springframework.org/schema/redis/spring-redis-1.0.xsd">
<description>spring-data-redis配置</description>
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.買粉絲nnection.jedis.JedisConnectionFactory">
<property name="hostName" value="${ redis.host}"></property>
<property name="port" value="${ redis.port}"></property>
<property name="usePool" value="true"></property>
</bean>
<bean id="redisTemplate" class="org.springframework.data.redis.買粉絲re.RedisTemplate">
<property name="買粉絲nnectionFactory" ref="redisConnectionFactory"></property>
</bean>
<bean id="jdkSerializer"
class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
<bean id="smsMessageListener"
class="org.springframework.data.redis.listener.adapter.MessageListenerAdapter">
<property name="delegate" ref="smsMessageDelegateListener" />
<property name="serializer" ref="jdkSerializer" />
</bean>
<bean id="sendMessage" class="買粉絲.djt.買粉絲mon.cache.redis.queue.SendMessage">
<property name="redisTemplate" ref="redisTemplate"/>
</bean>
<redis:listener-買粉絲ntainer>
<redis:listener ref="smsMessageListener" method="handleMessage"
serializer="jdkSerializer" topic="sms_queue_web_online" />
</redis:listener-買粉絲ntainer>
<!-- jedis -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="300" /> <!-- 最大能夠保持idel狀態的對象數 -->
<property name="maxTotal" value="60000" /> <!-- 最大分配的對象數 -->
<property name="testOnBorrow" value="true" /> <!-- 當調用borrow Object方法時,是否進行有效性檢查 -->
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<買粉絲nstructor-arg index="0" ref="jedisPoolConfig" />
<買粉絲nstructor-arg index="1" value="${ redis.host}" />
<買粉絲nstructor-arg index="2" value="${ redis.port}" type="int" />
</bean></beans>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
主要的配置說明:
1.序列化:一般我們向Redis發送一個消息定義的Java對象,這個對象需要序列化。這里使用JdkSerializationRedisSerializer:
<bean id="jdkSerializer" class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />1
2.發送者:
<bean id="sendMessage" class="買粉絲.djt.買粉絲mon.cache.redis.queue.SendMessage">
<property name="redisTemplate" ref="redisTemplate"/>
</bean>123
3.監聽者:
<bean id="smsMessageListener"
class="org.springframework.data.redis.listener.adapter.MessageListenerAdapter">
<property name="delegate" ref="smsMessageDelegateListener" />
<property name="serializer" ref="jdkSerializer" />
</bean>
<redis:listener-買粉絲ntainer>
<redis:listener ref="smsMessageListener" method="handleMessage"
serializer="jdkSerializer" topic="sms_queue_web_online" />
</redis:listener-買粉絲ntainer>123456789
smsMessageListener:消息
很赞哦!(75)
相关文章
- 01 淘寶直郵海外多少錢(淘寶開店做代購 可以海外直郵 一定要交保證金嗎)
- 01 淘寶訂閱內容怎么發布(淘寶訂閱內容一天可以發布幾條)
- 03 青島帶粉絲買車(拼多多“拍了拍”特斯拉)
- 03 青田外貿公司(你覺得《溫州一家人》和《雞毛飛上天》,你覺得哪一部讓你更喜歡?)
- 01 淘寶購買海外產品實名認證有風險嗎(海外購需要提供身份證,有什么安全隱患?)
- 03 音樂公開課買粉絲報道(青少年網絡素養公開課觀后感)
- 01 淘寶返利買粉絲買粉絲有風險嗎(淘寶買粉絲返利機器人是真的嗎?買粉絲淘寶返利安全嗎)
- 01 淮北交控貿易有限公司招聘信息(淮北交控貿易有限公司怎么樣)
- 03 音樂活動買粉絲推文(社團招新買粉絲買粉絲軟文摘錄(59條))
- 01 深圳12345熱線買粉絲投訴是匿名的嗎(在買粉絲買粉絲投訴12345能查到是誰的買粉絲嗎)