/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.stream.reactive;

import reactor.core.publisher.Flux;
import rx.Observable;
import rx.RxReactiveStreams;

import org.springframework.cloud.stream.binding.StreamListenerResultAdapter;
import org.springframework.messaging.MessageChannel;
import org.springframework.util.Assert;

/**
 * A {@link StreamListenerResultAdapter} from an {@link Observable}
 * return type to a bound {@link MessageChannel}.
 * @author Marius Bogoevici
 */
public class ObservableToMessageChannelResultAdapter
		implements StreamListenerResultAdapter<Observable<?>, MessageChannel> {

	private FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter;

	public ObservableToMessageChannelResultAdapter(
			FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter) {
		Assert.notNull(fluxToMessageChannelResultAdapter, "cannot be null");
		this.fluxToMessageChannelResultAdapter = fluxToMessageChannelResultAdapter;
	}

	@Override
	public boolean supports(Class<?> resultType, Class<?> bindingTarget) {
		return Observable.class.isAssignableFrom(resultType)
				&& MessageChannel.class.isAssignableFrom(bindingTarget);
	}

	public void adapt(Observable<?> streamListenerResult, MessageChannel bindingTarget) {
		this.fluxToMessageChannelResultAdapter.adapt(Flux.from(RxReactiveStreams.toPublisher(streamListenerResult)),
				bindingTarget);
	}
}

@@ -13,16 +13,21 @@
 ght 2016
+-2017
  the ori
@@ -51,16 +51,16 @@
 uthors.%0A
-
  *%0A * Li
@@ -667,16 +667,54 @@
 ctive;%0A%0A
+import org.reactivestreams.Publisher;%0A
 import r
@@ -1086,16 +1086,19 @@
 annel%7D.%0A
+ *%0A
  * @auth
@@ -1900,121 +1900,169 @@
 %7B%0A%09%09
-this.fluxToMessageChannelResultAdapter.adapt(Flux.from(RxReactiveStreams.toPublisher(streamListenerResult)),%0A%09%09%09%09
+Publisher%3C?%3E adaptedPublisher = RxReactiveStreams.toPublisher(streamListenerResult);%0A%09%09this.fluxToMessageChannelResultAdapter.adapt(Flux.from(adaptedPublisher), 
 bind

Fix compilation issue on ObservableToMessageChannelResultAdapter