2017-01-18 5 views
1

json 문자열의 필드 값 카운터를 사용하는 Spring XD 스트림을 작성하려고합니다. Json 문자열은 application/json의 Content-Type 헤더가있는 RabbitMQ 대기열을 통해 메시지로 전송됩니다. Spring XD는 메시지 (Json 문자열)를 기록하고 파일에 기록하지만 필드 값 카운터를 반환하지 않으며 스프링 xd 쉘 (xd :> 필드 값 카운터 목록)의 목록에도 표시하지 않습니다.RabbitMQ를 통해 전송되는 json 문자열의 Spring XD 필드 값 카운터를 가져올 수 없습니다.

여기 내 껍질이 여기

stream create rabbitqueue1 --definition "rabbit | log" 

stream create rabbitqueue1jsonset1 --definition "tap:stream:rabbitqueue1 > field-value-counter --fieldName=type --name=proftype" --deploy 

stream create rabbitqueue1out --definition "tap:stream:rabbitqueue1 > file --binary=true --name=rabbitqueue1outfile" --deploy 

stream deploy rabbitqueue1 

명령 봄 XD 스트림이 JSON 문자열의 필드 값을 계산하지 않는 이유

{ 
"created": "2017-01-18T09:45:34.716+05:30", 
"firstName": "FirstName", 
"id": 1, 
"lastName": "LastName", 
"profileName": "Profname", 
"type": "admin" 
} 

질문은 예제 JSON 문자열입니다입니까?

답변

1

FVC는 Tuple 또는 String 페이로드 (또는 자바 빈) 만 처리 할 수 ​​있습니다.

콘텐트 유형이 text/plain이 아닌 경우 래빗 소스는 기본적으로 byte[]을 생성합니다.

--inputType=text/plainfield-value-counter에 추가하면 메시지 버스가 byte[]String으로 변환합니다.