All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.task.service.MinaEventTransport Maven / Gradle / Ivy

There is a newer version: 5.1.1
Show newest version
package org.drools.task.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.mina.core.session.IoSession;
import org.drools.eventmessaging.EventTriggerTransport;
import org.drools.eventmessaging.Payload;

public class MinaEventTransport implements EventTriggerTransport {
    private String uuid;
    private Map sessions;
    private int responseId;
    private boolean remove;
    
    MinaEventTransport(String uuid, int responseId, Map sessions, boolean remove) {
        this.uuid = uuid;
        this.responseId = responseId;
        this.sessions = sessions;
        this.remove = remove;
    }

    public void trigger(Payload payload) {        
        IoSession session = sessions.get( uuid );
        List args = new ArrayList( 1 );
        args.add( payload );
        Command cmd = new Command( responseId, CommandName.EventTriggerResponse, args);             
        session.write( cmd );        
    }
    
    public boolean isRemove() {
        return this.remove;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy