Restored HTTP publish of events instead of logging on sysout
This commit is contained in:
parent
313881d04b
commit
858f2a6d24
2
pom.xml
2
pom.xml
|
@ -94,7 +94,7 @@
|
|||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.gcube.portal.event.publisher.lr62;
|
||||
|
||||
import org.gcube.event.publisher.AbstractEventPublisher;
|
||||
import org.gcube.event.publisher.Event;
|
||||
import org.gcube.event.publisher.EventSender;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.gcube.event.publisher.HTTPEventSender;
|
||||
import org.gcube.oidc.rest.OpenIdConnectConfiguration;
|
||||
import org.gcube.portal.oidc.lr62.LiferayOpenIdConnectConfiguration;
|
||||
|
||||
import com.liferay.portal.kernel.log.Log;
|
||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||
|
@ -11,22 +14,28 @@ public abstract class AbstractLR62EventPublisher extends AbstractEventPublisher
|
|||
|
||||
protected static final Log log = LogFactoryUtil.getLog(AbstractLR62EventPublisher.class);
|
||||
|
||||
protected static final boolean PUBLISH_ON_SYSOUT = false;
|
||||
|
||||
public AbstractLR62EventPublisher() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected EventSender createEventSender() {
|
||||
// OpenIdConnectConfiguration openIdConnectConfiguration = LiferayOpenIdConnectConfiguration.getConfiguration();
|
||||
// EventPublisherConfiguration eventPublisherConfiguration = EventPublisherConfiguration.getConfiguration();
|
||||
// return new HTTPEventSender(eventPublisherConfiguration.getEventPublisherURL(),
|
||||
// openIdConnectConfiguration.getPortalClientId(), openIdConnectConfiguration.getPortalClientSecret(),
|
||||
// openIdConnectConfiguration.getTokenURL());
|
||||
return new EventSender() {
|
||||
@Override
|
||||
public void send(JSONObject event) {
|
||||
System.out.println(event);
|
||||
}
|
||||
};
|
||||
if (PUBLISH_ON_SYSOUT) {
|
||||
return new EventSender() {
|
||||
@Override
|
||||
public void send(Event event) {
|
||||
System.out.println(event);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
OpenIdConnectConfiguration openIdConnectConfiguration = LiferayOpenIdConnectConfiguration
|
||||
.getConfiguration();
|
||||
EventPublisherConfiguration eventPublisherConfiguration = EventPublisherConfiguration.getConfiguration();
|
||||
return new HTTPEventSender(eventPublisherConfiguration.getEventPublisherURL(),
|
||||
openIdConnectConfiguration.getPortalClientId(), openIdConnectConfiguration.getPortalClientSecret(),
|
||||
openIdConnectConfiguration.getTokenURL());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue