package com.heroku.myorchestrator.consumers.common;

import com.heroku.myorchestrator.config.enumerate.Kind;
import com.heroku.myorchestrator.consumers.ConsumerRouteBuilder;
import com.heroku.myorchestrator.util.MessageUtil;
import com.heroku.myorchestrator.util.consumers.IronmqUtil;
import org.springframework.stereotype.Component;

@Component
public class ChangingConsumer extends ConsumerRouteBuilder {

    public ChangingConsumer() {
        ironmq().changed();
        route().changing();
    }

    @Override
    public void configure() throws Exception {
        from(ironmq().consumeUri())
                .routeId(route().id())
                .choice()
                .when(MessageUtil.messageKindIs(Kind.amiami_item))
                .to("log:changing_" + Kind.amiami_item.expression())
                .when(MessageUtil.messageKindIs(Kind.amiami_original_titles))
                .to("log:changing_" + Kind.amiami_original_titles.expression())
                .when(MessageUtil.messageKindIs(Kind.female_seiyu_category_members))
                .to("log:changing_" + Kind.female_seiyu_category_members.expression())
                .when(MessageUtil.messageKindIs(Kind.koepota_events))
                .to("log:changing_" + Kind.koepota_events.expression())
                .when(MessageUtil.messageKindIs(Kind.koepota_seiyu))
                .to("log:changing_" + Kind.koepota_seiyu.expression())
                .when(MessageUtil.messageKindIs(Kind.koepota_seiyu_all))
                .to("log:changing_" + Kind.koepota_seiyu_all.expression())
                .when(MessageUtil.messageKindIs(Kind.male_seiyu_category_members))
                .to("log:changing_" + Kind.male_seiyu_category_members.expression())
                .when(MessageUtil.messageKindIs(Kind.seiyu_category_members))
                .to("log:changing_" + Kind.seiyu_category_members.expression())
                .when(MessageUtil.messageKindIs(Kind.seiyu_category_members_include_template))
                .to("log:changing_" + Kind.seiyu_category_members_include_template.expression())
                .when(MessageUtil.messageKindIs(Kind.seiyu_has_recentchanges))
                .to("log:changing_" + Kind.seiyu_has_recentchanges.expression())
                .when(MessageUtil.messageKindIs(Kind.seiyu_template_include_pages))
                .to("log:changing_" + Kind.seiyu_template_include_pages.expression())
                .endChoice()
                .filter(MessageUtil.loadAffect())
                .split().body()
                .routingSlip(IronmqUtil.affectQueueUri());
    }
}

@@ -786,32 +786,61 @@
 m.expression())%0A
+                .otherwise()%0A
                 
@@ -897,24 +897,24 @@
 al_titles))%0A
-
             
@@ -973,32 +973,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -1174,32 +1174,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -1345,32 +1345,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -1514,32 +1514,61 @@
 u.expression())%0A
+                .otherwise()%0A
                 
@@ -1691,32 +1691,61 @@
 l.expression())%0A
+                .otherwise()%0A
                 
@@ -1888,32 +1888,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -2075,32 +2075,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -2296,32 +2296,61 @@
 e.expression())%0A
+                .otherwise()%0A
                 
@@ -2485,32 +2485,61 @@
 s.expression())%0A
+                .otherwise()%0A
                 
@@ -2684,32 +2684,102 @@
 s.expression())%0A
+                .otherwise()%0A                .to(%22log:changing_none%22)%0A
                 
@@ -2786,14 +2786,8 @@
 .end
-Choice
 ()%0A 

modify message route on ChangingConsumer