<commit_before>package library.enrichment.messaging

import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.amqp.core.Binding
import org.springframework.amqp.core.BindingBuilder
import org.springframework.amqp.core.Queue
import org.springframework.amqp.core.TopicExchange
import org.springframework.amqp.rabbit.connection.ConnectionFactory
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
import org.springframework.amqp.support.converter.MessageConverter
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.stereotype.Component

@Configuration
internal class MessagingConfiguration(
        private val connectionFactory: ConnectionFactory,
        private val exchange: BookEventExchange,
        private val queue: BookAddedEventQueue,
        private val messageListener: BookAddedMessageListener
) {

    @Bean fun messageConverter(objectMapper: ObjectMapper): MessageConverter
            = Jackson2JsonMessageConverter(objectMapper)

    /**
     * Binds the [BookAddedEventQueue] to the [BookEventsExchange] in order to
     * receive messages on that queue.
     */
    @Bean fun bookAddedEventBinding(): Binding
            = BindingBuilder.bind(queue).to(exchange).with("book-added")

    @Bean fun bookAddedEventMessageContainer() = SimpleMessageListenerContainer(connectionFactory).apply {
        setQueueNames(queue.name)
        setMessageListener(messageListener)
    }

    @Component
    internal class BookEventExchange : TopicExchange("book-events")

    @Component
    internal class BookAddedEventQueue : Queue("library-enrichment.book-events.book-added", true)

}<commit_msg>fixed wrong message listener setter<commit_after>package library.enrichment.messaging

import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.amqp.core.Binding
import org.springframework.amqp.core.BindingBuilder
import org.springframework.amqp.core.Queue
import org.springframework.amqp.core.TopicExchange
import org.springframework.amqp.rabbit.connection.ConnectionFactory
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
import org.springframework.amqp.support.converter.MessageConverter
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.stereotype.Component

@Configuration
internal class MessagingConfiguration(
        private val connectionFactory: ConnectionFactory,
        private val exchange: BookEventExchange,
        private val queue: BookAddedEventQueue,
        private val bookAddedMessageListener: BookAddedMessageListener
) {

    @Bean fun messageConverter(objectMapper: ObjectMapper): MessageConverter
            = Jackson2JsonMessageConverter(objectMapper)

    /**
     * Binds the [BookAddedEventQueue] to the [BookEventsExchange] in order to
     * receive messages on that queue.
     */
    @Bean fun bookAddedEventBinding(): Binding
            = BindingBuilder.bind(queue).to(exchange).with("book-added")

    @Bean fun bookAddedEventMessageContainer() = SimpleMessageListenerContainer(connectionFactory).apply {
        setQueueNames(queue.name)
        setMessageListener(bookAddedMessageListener)
    }

    @Component
    internal class BookEventExchange : TopicExchange("book-events")

    @Component
    internal class BookAddedEventQueue : Queue("library-enrichment.book-events.book-added", true)

}
{'fraction_non_alphanumeric': 0.07512248230811105, 'fraction_numerical': 0.0010887316276537834, 'mean_word_length': 5.074380165289257, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3145413', 'n_tokens_mistral': 918, 'n_tokens_neox': 872, 'n_words': 180}