/** * Specifies a SpEL Expression to be used to determine the key for the Redis store. * If an expression is not needed, then a literal value may be passed to the * {@link #setKey(String)} method instead of this one (they are mutually exclusive). * If neither setter is called, the default expression will be 'headers.{@link RedisHeaders#KEY}'. * @param keyExpression The key expression. * @see #setKey(String) * @since 5.0 */ public void setKeyExpressionString(String keyExpression) { Assert.hasText(keyExpression, "'keyExpression' must not be empty"); setKeyExpression(EXPRESSION_PARSER.parseExpression(keyExpression)); }
/** * Specifies the key for the Redis store. If an expression is needed, then call * {@link #setKeyExpression(Expression)} instead of this method (they are mutually exclusive). * If neither setter is called, the default expression will be 'headers.{@link RedisHeaders#KEY}'. * @param key The key. * @see #setKeyExpression */ public void setKey(String key) { Assert.hasText(key, "key must not be empty"); this.setKeyExpression(new LiteralExpression(key)); }
/** * Specifies a SpEL Expression to be used to determine the key for the Redis store. * If an expression is not needed, then a literal value may be passed to the * {@link #setKey(String)} method instead of this one (they are mutually exclusive). * If neither setter is called, the default expression will be 'headers.{@link RedisHeaders#KEY}'. * @param keyExpression The key expression. * @see #setKey(String) * @since 5.0 */ public void setKeyExpressionString(String keyExpression) { Assert.hasText(keyExpression, "'keyExpression' must not be empty"); setKeyExpression(EXPRESSION_PARSER.parseExpression(keyExpression)); }
/** * Specifies the key for the Redis store. If an expression is needed, then call * {@link #setKeyExpression(Expression)} instead of this method (they are mutually exclusive). * If neither setter is called, the default expression will be 'headers.{@link RedisHeaders#KEY}'. * @param key The key. * @see #setKeyExpression */ public void setKey(String key) { Assert.hasText(key, "key must not be empty"); this.setKeyExpression(new LiteralExpression(key)); }
@Bean @ServiceActivator(inputChannel = Sink.INPUT) public MessageHandler redisSinkMessageHandler() { if (this.redisSinkProperties.isKey()) { RedisStoreWritingMessageHandler redisStoreWritingMessageHandler = new RedisStoreWritingMessageHandler( this.redisConnectionFactory); redisStoreWritingMessageHandler.setKeyExpression(this.redisSinkProperties.keyExpression()); return redisStoreWritingMessageHandler; } else if (this.redisSinkProperties.isQueue()) { return new RedisQueueOutboundChannelAdapter(this.redisSinkProperties.queueExpression(), this.redisConnectionFactory); } else { // must be topic RedisPublishingMessageHandler redisPublishingMessageHandler = new RedisPublishingMessageHandler( this.redisConnectionFactory); redisPublishingMessageHandler.setTopicExpression(this.redisSinkProperties.topicExpression()); return redisPublishingMessageHandler; } }