Project

General

Profile

Spring server push to JWT

Added by Kushan Gunaratne almost 9 years ago

Hi,

I am using JWt 3.3.4 client side and spring for server side. I need to push update to JWt from a Spring based Java server.

I think can't use triggerUpdate and enableUpdates on spring. How can I solve this issue?

Pls send answer as soon as possible.

Kushan.


Replies (4)

RE: Spring server push to JWT - Added by Wim Dumon almost 9 years ago

Hey Kushan,

I'm not sure if I understand your architecture correctly. Can you elaborate what your situation is and what you would like to do?

BR,

Wim.

RE: Spring server push to JWT - Added by Kushan Gunaratne almost 9 years ago

HI Wim,

Thanks for your feedback.

I'm using JWt for front-end and spring and hibernate for back-end on tomcat 7 server environment.

My problem is that, separate spring thread insert a record to a table. After that I want to send a notification to user.

Domain Class:

@Entity
@Table(name = "job_report")
public class JobReport extends AbstractEntity {

    @NotNull
    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false)
    private JobStatus status;

    @NotNull
    @Column(name = "processed_date", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date processedDate;


    private boolean seen;

    // getters and setters goes here


    @PostPersist
    public void touchForCreate() {
       // Identify insertion and set flag to spring environment  
    }
}

Using @PostPersist we can Identify new insertion happen to that table.

On JWt front-end I accessed spring using

AbstractApplicationContext ctx = ClassPathXmlApplicationContext("classpath:config/app.xml");

public static JobReportService getJobReportService() {
     return (JobReportService) ctx.getBean("jobReportServiceImpl");
}

Now spring environment knows there is a new insert to job_report table, but How can I reflect this into JWt front-end.

In my current environment, I used timer and continuously checking spring back-end for new insertion.

Thanks,

Kushan

RE: Spring server push to JWT - Added by Koen Deforche almost 9 years ago

Hey Kushan,

You could use WtServlet.postAll() to post the event to all your sessions?

Why do you suspect there to be a problem related to Spring?

Koen

RE: Spring server push to JWT - Added by Kushan Gunaratne almost 9 years ago

Hello Koen,

I fixed my issue. Thank you for your feedback.

Kushan

    (1-4/4)